Fix python setup file.

This commit is contained in:
DelinWorks 2022-07-07 14:37:59 +03:00
parent a4d40c0bbe
commit 0493ae832f
1 changed files with 23 additions and 23 deletions

View File

@ -26,11 +26,11 @@ THE SOFTWARE.
****************************************************************************"""
'''
This script will install environment variables needed to by adxe. It will set these envrironment variables:
* ADXE_CONSOLE_ROOT: used to run adxe console tools
This script will install environment variables needed to by axis. It will set these envrironment variables:
* AXIS_CONSOLE_ROOT: used to run axis console tools
* ANDROID_NDK: used to build android native codes
* ANDROID_SDK: used to generate applicatoin on Android through commands
* ADXE_ROOT: path where adxe is installed
* AXIS_ROOT: path where axis is installed
On Max OS X, when start a shell, it will read these files and execute commands in sequence:
@ -63,8 +63,8 @@ from time import time
from time import sleep
from os.path import dirname
ADXE_ROOT = 'ADXE_ROOT'
ADXE_CONSOLE_ROOT = 'ADXE_CONSOLE_ROOT'
AXIS_ROOT = 'AXIS_ROOT'
AXIS_CONSOLE_ROOT = 'AXIS_CONSOLE_ROOT'
ANDROID_NDK = 'ANDROID_NDK'
ANDROID_SDK = 'ANDROID_SDK'
@ -191,7 +191,7 @@ class SetEnvVar(object):
self.need_backup = False
file = open(self.file_used_for_setup, 'a')
file.write('\n# Add environment variable %s for adxe\n' % key)
file.write('\n# Add environment variable %s for axis\n' % key)
file.write('export %s="%s"\n' % (key, value))
file.write('export PATH=$%s:$PATH\n' % key)
if key == ANDROID_SDK:
@ -454,41 +454,41 @@ class SetEnvVar(object):
print(" ->Add directory \"%s\" into PATH failed!\n" % add_dir)
def set_console_root(self):
print("->Check environment variable %s" % ADXE_CONSOLE_ROOT)
adxe_console_root = os.path.join(
print("->Check environment variable %s" % AXIS_CONSOLE_ROOT)
axis_console_root = os.path.join(
self.current_absolute_path, 'tools', 'console', 'bin')
old_dir = self._find_environment_variable(ADXE_CONSOLE_ROOT)
old_dir = self._find_environment_variable(AXIS_CONSOLE_ROOT)
if old_dir is None:
# add environment variable
if self._isWindows():
self.set_windows_path(adxe_console_root)
self.set_windows_path(axis_console_root)
self._set_environment_variable(
ADXE_CONSOLE_ROOT, adxe_console_root)
AXIS_CONSOLE_ROOT, axis_console_root)
else:
if old_dir == adxe_console_root:
if old_dir == axis_console_root:
# is same with before, nothing to do
return
# update the environment variable
if self._isWindows():
self.remove_dir_from_win_path(old_dir)
self.set_windows_path(adxe_console_root)
self.set_windows_path(axis_console_root)
self._force_update_env(ADXE_CONSOLE_ROOT, adxe_console_root)
self._force_update_env(AXIS_CONSOLE_ROOT, axis_console_root)
def set_adxe_root(self):
print("->Check environment variable %s" % ADXE_ROOT)
adxe_root = self.current_absolute_path
old_dir = self._find_environment_variable(ADXE_ROOT)
def set_axis_root(self):
print("->Check environment variable %s" % AXIS_ROOT)
axis_root = self.current_absolute_path
old_dir = self._find_environment_variable(AXIS_ROOT)
if old_dir is None:
# add environment variable
self._set_environment_variable(ADXE_ROOT, adxe_root)
self._set_environment_variable(AXIS_ROOT, axis_root)
else:
if old_dir == adxe_root:
if old_dir == axis_root:
# is same with before, nothing to do
return
self._force_update_env(ADXE_ROOT, adxe_root)
self._force_update_env(AXIS_ROOT, axis_root)
def _force_update_unix_env(self, var_name, value):
import re
@ -641,11 +641,11 @@ class SetEnvVar(object):
def set_environment_variables(self, ndk_root, android_sdk_root, quiet):
print('\nSetting up adxe...')
print('\nSetting up axis...')
self.file_used_for_setup = self._get_filepath_for_setup()
self.set_adxe_root()
self.set_axis_root()
self.set_console_root()
if self._isWindows():