Skip to content

Commit

Permalink
Merge pull request #1165 from pakal/user_expansion_in_paths
Browse files Browse the repository at this point in the history
Expand "~" before every path normalization.
  • Loading branch information
AndreMiras committed Jun 25, 2020
2 parents a967c09 + 1323c05 commit f858adf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions buildozer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ def build_application(self):

def _copy_application_sources(self):
# XXX clean the inclusion/exclusion algo.
source_dir = realpath(self.config.getdefault('app', 'source.dir', '.'))
source_dir = realpath(expanduser(self.config.getdefault('app', 'source.dir', '.')))
include_exts = self.config.getlist('app', 'source.include_exts', '')
exclude_exts = self.config.getlist('app', 'source.exclude_exts', '')
exclude_dirs = self.config.getlist('app', 'source.exclude_dirs', '')
Expand Down Expand Up @@ -807,7 +807,7 @@ def namify(self, name):

@property
def root_dir(self):
return realpath(dirname(self.specfilename))
return realpath(expanduser(dirname(self.specfilename)))

@property
def user_build_dir(self):
Expand All @@ -821,7 +821,7 @@ def user_build_dir(self):
build_dir = self.config.getdefault('buildozer', 'build_dir', build_dir)

if build_dir is not None:
build_dir = realpath(join(self.root_dir, build_dir))
build_dir = realpath(join(self.root_dir, expanduser(build_dir)))

return build_dir

Expand Down
2 changes: 1 addition & 1 deletion buildozer/scripts/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def _ssh_mkdir(self, *args):

def _ssh_sync(self, directory, mode='put'):
self.debug('Syncing {} directory'.format(directory))
directory = realpath(directory)
directory = realpath(expanduser(directory))
base_strip = directory.rfind('/')
if mode == 'get':
local_dir = join(directory, 'bin')
Expand Down
14 changes: 7 additions & 7 deletions buildozer/targets/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def __init__(self, *args, **kwargs):

hook = self.buildozer.config.getdefault("app", "p4a.hook", None)
if hook is not None:
self.extra_p4a_args += ' --hook={}'.format(realpath(hook))
self.extra_p4a_args += ' --hook={}'.format(realpath(expanduser(hook)))
port = self.buildozer.config.getdefault('app', 'p4a.port', None)
if port is not None:
self.extra_p4a_args += ' --port={}'.format(port)
Expand Down Expand Up @@ -868,16 +868,16 @@ def execute_build_package(self, build_cmd):
blacklist_src = self.buildozer.config.getdefault('app', 'android.blacklist_src', None)
if whitelist_src:
cmd.append('--whitelist')
cmd.append(realpath(whitelist_src))
cmd.append(realpath(expanduser(whitelist_src)))
if blacklist_src:
cmd.append('--blacklist')
cmd.append(realpath(blacklist_src))
cmd.append(realpath(expanduser(blacklist_src)))

# support for aars
aars = self.buildozer.config.getlist('app', 'android.add_aars', [])
for aar in aars:
cmd.append('--add-aar')
cmd.append(realpath(aar))
cmd.append(realpath(expanduser(aar)))

# support for uses-lib
uses_library = self.buildozer.config.getlist(
Expand Down Expand Up @@ -1235,8 +1235,8 @@ def _update_libraries_references(self, dist_dir):
# convert our references to relative path
app_references = self.buildozer.config.getlist(
'app', 'android.library_references', [])
source_dir = realpath(self.buildozer.config.getdefault(
'app', 'source.dir', '.'))
source_dir = realpath(expanduser(self.buildozer.config.getdefault(
'app', 'source.dir', '.')))
for cref in app_references:
# get the full path of the current reference
ref = realpath(join(source_dir, cref))
Expand All @@ -1246,7 +1246,7 @@ def _update_libraries_references(self, dist_dir):
cref))
exit(1)
# get a relative path from the project file
ref = relpath(ref, realpath(dist_dir))
ref = relpath(ref, realpath(expanduser(dist_dir)))
# ensure the reference exists
references.append(ref)

Expand Down

0 comments on commit f858adf

Please sign in to comment.