-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
37 lines (32 loc) · 1.07 KB
/
build.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 22 18:19:24 2018
@author: zx013
"""
import os
import sys
#获取在wsl中的路径
def wsl_path(path):
path = path.replace(os.path.sep, '/')
drive, path = path.split('/', 1)
path = '/mnt/{}/{}'.format(drive.replace(':', '').lower(), path)
return path
def build(path='.'):
path = os.getcwd()
if os.path.isfile(os.path.join(path, 'main.py')):
path = wsl_path(path)
cmd = "powershell debian run 'source /root/.bashrc; cd {}; rm -rf /root/.buildozer/android/platform/build/dists/zx013/build; cp -rf /root/buildozer.spec .; buildozer android release; sleep 2'".format(path)
print(cmd)
os.system(cmd)
else:
print('Can not find main.py in {}, please check it.'.format(path))
if __name__ == '__main__':
if len(sys.argv) > 1:
path = sys.argv[1]
if os.path.isdir(path):
os.chdir(path)
else:
print('Path {} is not exist, use base dir.'.format(path))
else:
path = '.'
build(path)