mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-15 11:40:30 +03:00
refactor env handling for FDroidPopen to support .fdroid.* metadata
The start up sequence of processes that are based on the .fdroid.* metadata is a bit different, so this ensures that the environment variables get properly initialized in all cases. This also creates a single function where the environment is set. Before it was being set in multiple places across multiple files.
This commit is contained in:
parent
9abb80b3b7
commit
3768d7a4d6
6 changed files with 47 additions and 24 deletions
|
|
@ -64,7 +64,7 @@ class CommonTest(unittest.TestCase):
|
|||
|
||||
def testIsApkDebuggable(self):
|
||||
config = dict()
|
||||
config['sdk_path'] = os.getenv('ANDROID_HOME')
|
||||
fdroidserver.common.fill_config_defaults(config)
|
||||
fdroidserver.common.config = config
|
||||
self._set_build_tools()
|
||||
config['aapt'] = fdroidserver.common.find_sdk_tools_cmd('aapt')
|
||||
|
|
|
|||
|
|
@ -25,8 +25,9 @@ class ImportTest(unittest.TestCase):
|
|||
|
||||
def test_import_gitlab(self):
|
||||
# FDroidPopen needs some config to work
|
||||
fdroidserver.common.config = dict()
|
||||
fdroidserver.common.config['sdk_path'] = '/fake/path/to/android-sdk'
|
||||
config = dict()
|
||||
fdroidserver.common.fill_config_defaults(config)
|
||||
fdroidserver.common.config = config
|
||||
|
||||
url = 'https://gitlab.com/fdroid/fdroidclient'
|
||||
app = fdroidserver.metadata.get_default_app_info()
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class InstallTest(unittest.TestCase):
|
|||
|
||||
def test_devices(self):
|
||||
config = dict()
|
||||
config['sdk_path'] = os.getenv('ANDROID_HOME')
|
||||
fdroidserver.common.fill_config_defaults(config)
|
||||
fdroidserver.common.config = config
|
||||
config['adb'] = fdroidserver.common.find_sdk_tools_cmd('adb')
|
||||
self.assertTrue(os.path.exists(config['adb']))
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ class UpdateTest(unittest.TestCase):
|
|||
if not os.path.exists(getsig_dir + "/getsig.class"):
|
||||
logging.critical("getsig.class not found. To fix: cd '%s' && ./make.sh" % getsig_dir)
|
||||
sys.exit(1)
|
||||
# FDroidPopen needs some config to work
|
||||
config = dict()
|
||||
fdroidserver.common.fill_config_defaults(config)
|
||||
fdroidserver.common.config = config
|
||||
p = FDroidPopen(['java', '-cp', os.path.join(os.path.dirname(__file__), 'getsig'),
|
||||
'getsig', os.path.join(os.getcwd(), apkfile)])
|
||||
sig = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue