Skip to content

Commit 23a969b

Browse files
committed
fixes to storage dir usage
1 parent 2c37ed6 commit 23a969b

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

pythonforandroid/build.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def setup_dirs(self, storage_dir):
9797
self.build_dir = join(self.storage_dir, 'build')
9898
self.dist_dir = join(self.storage_dir, 'dists')
9999

100+
def ensure_dirs(self):
100101
ensure_dir(self.storage_dir)
101102
ensure_dir(self.build_dir)
102103
ensure_dir(self.dist_dir)
@@ -155,7 +156,7 @@ def ndk_dir(self):
155156
def ndk_dir(self, value):
156157
self._ndk_dir = value
157158

158-
def prepare_build_environment(self, storage_dir, user_sdk_dir, user_ndk_dir,
159+
def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
159160
user_android_api, user_ndk_ver):
160161
'''Checks that build dependencies exist and sets internal variables
161162
for the Android SDK etc.
@@ -164,7 +165,7 @@ def prepare_build_environment(self, storage_dir, user_sdk_dir, user_ndk_dir,
164165
165166
'''
166167

167-
self.setup_dirs(storage_dir)
168+
self.ensure_dirs()
168169

169170
if self._build_env_prepared:
170171
return

pythonforandroid/toolchain.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ def require_prebuilt_dist(func):
9393
def wrapper_func(self, args):
9494
ctx = self.ctx
9595
ctx.set_archs(self._archs)
96-
ctx.prepare_build_environment(storage_dir=self.storage_dir,
97-
user_sdk_dir=self.sdk_dir,
96+
ctx.prepare_build_environment(user_sdk_dir=self.sdk_dir,
9897
user_ndk_dir=self.ndk_dir,
9998
user_android_api=self.android_api,
10099
user_ndk_ver=self.ndk_version)
@@ -298,6 +297,7 @@ def __init__(self):
298297
if args.debug:
299298
logger.setLevel(logging.DEBUG)
300299
self.storage_dir = args.storage_dir
300+
self.ctx.setup_dirs(self.storage_dir)
301301
self.sdk_dir = args.sdk_dir
302302
self.ndk_dir = args.ndk_dir
303303
self.android_api = args.android_api
@@ -423,7 +423,7 @@ def clean_dists(self, args):
423423
parser = argparse.ArgumentParser(
424424
description="Delete any distributions that have been built.")
425425
args = parser.parse_args(args)
426-
ctx = Context()
426+
ctx = self.ctx
427427
if exists(ctx.dist_dir):
428428
shutil.rmtree(ctx.dist_dir)
429429

@@ -438,7 +438,7 @@ def clean_builds(self, args):
438438
parser = argparse.ArgumentParser(
439439
description="Delete all build files (but not download caches)")
440440
args = parser.parse_args(args)
441-
ctx = Context()
441+
ctx = self.ctx
442442
# if exists(ctx.dist_dir):
443443
# shutil.rmtree(ctx.dist_dir)
444444
if exists(ctx.build_dir):
@@ -476,7 +476,7 @@ def clean_download_cache(self, args):
476476
parser = argparse.ArgumentParser(
477477
description="Delete all download caches")
478478
args = parser.parse_args(args)
479-
ctx = Context()
479+
ctx = self.ctx
480480
if exists(ctx.packages_path):
481481
shutil.rmtree(ctx.packages_path)
482482

@@ -641,7 +641,7 @@ def print_context_info(self, args):
641641
python-for-android will internally use for package building, along
642642
with information about where the Android SDK and NDK will be called
643643
from.'''
644-
ctx = Context()
644+
ctx = self.ctx
645645
for attribute in ('root_dir', 'build_dir', 'dist_dir', 'libs_dir',
646646
'ccache', 'cython', 'sdk_dir', 'ndk_dir',
647647
'ndk_platform', 'ndk_ver', 'android_api'):
@@ -661,7 +661,7 @@ def dists(self, args):
661661
def distributions(self, args):
662662
'''Lists all distributions currently available (i.e. that have already
663663
been built).'''
664-
ctx = Context()
664+
ctx = self.ctx
665665
dists = Distribution.get_distributions(ctx)
666666

667667
if dists:

0 commit comments

Comments
 (0)