From 13987b5c7733db582555de963e41518577ea74c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Fri, 18 Jul 2014 12:21:52 +0200 Subject: [PATCH] Use os.path.join instead of adding strings more often --- fdroidserver/common.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 2e0d258d..fff2e28a 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -362,9 +362,9 @@ def getvcs(vcstype, remote, local): if vcstype == 'bzr': return vcs_bzr(remote, local) if vcstype == 'srclib': - if local != 'build/srclib/' + remote: + if local != os.path.join('build', 'srclib', remote): raise VCSException("Error: srclib paths are hard-coded!") - return getsrclib(remote, 'build/srclib', raw=True) + return getsrclib(remote, os.path.join('build', 'srclib'), raw=True) raise VCSException("Invalid vcs type " + vcstype) @@ -787,7 +787,7 @@ class vcs_hg(vcs): p = SilentPopen(['hg', 'purge', '--all'], cwd=self.local) # Also delete untracked files, we have to enable purge extension for that: if "'purge' is provided by the following extension" in p.output: - with open(self.local + "/.hg/hgrc", "a") as myfile: + with open(os.path.join(self.local, '.hg', 'hgrc'), "a") as myfile: myfile.write("\n[extensions]\nhgext.purge=\n") p = SilentPopen(['hg', 'purge', '--all'], cwd=self.local) if p.returncode != 0: @@ -836,14 +836,14 @@ def retrieve_string(app_dir, string, xmlfiles=None): res_dirs = [ os.path.join(app_dir, 'res'), - os.path.join(app_dir, 'src/main'), + os.path.join(app_dir, 'src', 'main'), ] if xmlfiles is None: xmlfiles = [] for res_dir in res_dirs: for r, d, f in os.walk(res_dir): - if r.endswith('/values'): + if os.path.basename(r) == 'values': xmlfiles += [os.path.join(r, x) for x in f if x.endswith('.xml')] string_search = None