123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- # -*- coding:utf-8 -*-
- import platform, os
- def getSystemPath():
- '''
- 获取系统目录
- '''
- if platform.system() == 'Windows':
- return 'win'
- elif platform.system() == 'Darwin':
- return 'macos'
- else:
- return 'linux'
- def get_current_path():
- """
- 当前目录
- 根据需要修改为绝对路径
- """
- return '/opt/mixsdk/script2.0'
- # return os.path.join(sys.path[0], 'V2')
- def getToolWithSystem(tool):
- '''
- 获取系统相关工具
- '''
- system = getSystemPath()
- suffix = getSystemSuffix()
- return os.path.join(getFullToolPath(system), tool + suffix)
- def getFullToolPath(name):
- '''
- 获取工具的目录
- '''
- return get_full_path('tools', name)
- def get_full_path(gen, *name):
- '''
- 主目录拼接对应路径
- '''
- path = os.path.join(get_current_path(), gen)
- for n in name:
- path = os.path.join(path, str(n))
- return path
- def getChannelPath(sdk):
- """
- 获取渠道的目录
- """
- return get_full_path('channel', sdk)
- def getSystemSuffix():
- """
- 系统工具后缀
- """
- if platform.system() == 'Windows':
- return '.exe'
- else:
- return ''
- def get_aapt_path():
- """
- 获取aapt
- """
- return getToolWithSystem('aapt')
- def get_aapt2_path():
- """
- 获取aapt2
- """
- return getToolWithSystem('aapt2')
- def get_android_compile_tool_path():
- """
- 获取android.jar
- """
- return getFullToolPath('android.jar')
- def get_dx_path():
- """
- 获取dx.jar
- """
- return getFullToolPath('dx.jar')
- def get_d8_path():
- """
- 获取d8.jar
- """
- return getFullToolPath('d8.jar')
- def get_zipalign_path():
- """
- 获取zipalign
- """
- return getToolWithSystem('zipalign')
- def get_multidex_path():
- """
- 获取multidex.jar
- """
- return getFullToolPath('android-support-multidex.jar')
- def get_apktool_path():
- """
- 获取apktool.jar
- """
- return getFullToolPath('apktool_2.6.0.jar')
- def get_baksmali_path():
- """
- 获取baksmali.jar
- """
- return getFullToolPath('baksmali-2.3.jar')
- def get_apksigner_path():
- '''
- 获取apksigner.jar
- '''
- return getFullToolPath('apksigner.jar')
- def get_sdk_log_path(gcp_code):
- return get_full_path("log", gcp_code)
- def get_sdk_channel_path(channel):
- return get_full_path("channel", channel)
|