mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-09-17 18:50:11 +02:00
Replace some hard-coded paths with os.path.join
This commit is contained in:
parent
2c0be49124
commit
5cb47203b3
@ -101,7 +101,7 @@ def get_vagrant_sshinfo():
|
|||||||
raise BuildException("Error getting ssh config")
|
raise BuildException("Error getting ssh config")
|
||||||
vagranthost = 'default' # Host in ssh config file
|
vagranthost = 'default' # Host in ssh config file
|
||||||
sshconfig = paramiko.SSHConfig()
|
sshconfig = paramiko.SSHConfig()
|
||||||
sshf = open('builder/sshconfig', 'r')
|
sshf = open(os.path.join('builder', 'sshconfig'), 'r')
|
||||||
sshconfig.parse(sshf)
|
sshconfig.parse(sshf)
|
||||||
sshf.close()
|
sshf.close()
|
||||||
sshconfig = sshconfig.lookup(vagranthost)
|
sshconfig = sshconfig.lookup(vagranthost)
|
||||||
@ -180,13 +180,12 @@ def get_clean_vm(reset=False):
|
|||||||
p = subprocess.Popen(['vagrant', '--version'],
|
p = subprocess.Popen(['vagrant', '--version'],
|
||||||
stdout=subprocess.PIPE)
|
stdout=subprocess.PIPE)
|
||||||
vver = p.communicate()[0]
|
vver = p.communicate()[0]
|
||||||
if vver.startswith('Vagrant version 1.2'):
|
with open(os.path.join('builder', 'Vagrantfile'), 'w') as vf:
|
||||||
with open('builder/Vagrantfile', 'w') as vf:
|
if vver.startswith('Vagrant version 1.2'):
|
||||||
vf.write('Vagrant.configure("2") do |config|\n')
|
vf.write('Vagrant.configure("2") do |config|\n')
|
||||||
vf.write('config.vm.box = "buildserver"\n')
|
vf.write('config.vm.box = "buildserver"\n')
|
||||||
vf.write('end\n')
|
vf.write('end\n')
|
||||||
else:
|
else:
|
||||||
with open('builder/Vagrantfile', 'w') as vf:
|
|
||||||
vf.write('Vagrant::Config.run do |config|\n')
|
vf.write('Vagrant::Config.run do |config|\n')
|
||||||
vf.write('config.vm.box = "buildserver"\n')
|
vf.write('config.vm.box = "buildserver"\n')
|
||||||
vf.write('end\n')
|
vf.write('end\n')
|
||||||
@ -606,7 +605,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
|||||||
logging.info("Building native code in '%s'" % d)
|
logging.info("Building native code in '%s'" % d)
|
||||||
else:
|
else:
|
||||||
logging.info("Building native code in the main project")
|
logging.info("Building native code in the main project")
|
||||||
manifest = root_dir + '/' + d + '/AndroidManifest.xml'
|
manifest = os.path.join(root_dir, d, 'AndroidManifest.xml')
|
||||||
if os.path.exists(manifest):
|
if os.path.exists(manifest):
|
||||||
# Read and write the whole AM.xml to fix newlines and avoid
|
# Read and write the whole AM.xml to fix newlines and avoid
|
||||||
# the ndk r8c or later 'wordlist' errors. The outcome of this
|
# the ndk r8c or later 'wordlist' errors. The outcome of this
|
||||||
@ -662,7 +661,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
|||||||
bconfig = ConfigParser(defaults, allow_no_value=True)
|
bconfig = ConfigParser(defaults, allow_no_value=True)
|
||||||
bconfig.read(spec)
|
bconfig.read(spec)
|
||||||
|
|
||||||
distdir = 'python-for-android/dist/fdroid'
|
distdir = os.path.join('python-for-android', 'dist', 'fdroid')
|
||||||
if os.path.exists(distdir):
|
if os.path.exists(distdir):
|
||||||
shutil.rmtree(distdir)
|
shutil.rmtree(distdir)
|
||||||
|
|
||||||
@ -762,8 +761,10 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
|||||||
src = m.group(1)
|
src = m.group(1)
|
||||||
src = os.path.join(bindir, src) + '.apk'
|
src = os.path.join(bindir, src) + '.apk'
|
||||||
elif thisbuild['type'] == 'kivy':
|
elif thisbuild['type'] == 'kivy':
|
||||||
src = 'python-for-android/dist/default/bin/{0}-{1}-release.apk'.format(
|
src = os.path.join('python-for-android', 'dist', 'default', 'bin',
|
||||||
bconfig.get('app', 'title'), bconfig.get('app', 'version'))
|
'{0}-{1}-release.apk'.format(
|
||||||
|
bconfig.get('app', 'title'),
|
||||||
|
bconfig.get('app', 'version')))
|
||||||
elif thisbuild['type'] == 'gradle':
|
elif thisbuild['type'] == 'gradle':
|
||||||
|
|
||||||
if thisbuild['gradlepluginver'] >= LooseVersion('0.11'):
|
if thisbuild['gradlepluginver'] >= LooseVersion('0.11'):
|
||||||
|
@ -103,7 +103,7 @@ def check_tags(app, pattern):
|
|||||||
build_dir = os.path.join('build', 'srclib', app['Repo'])
|
build_dir = os.path.join('build', 'srclib', app['Repo'])
|
||||||
repotype = common.getsrclibvcs(app['Repo'])
|
repotype = common.getsrclibvcs(app['Repo'])
|
||||||
else:
|
else:
|
||||||
build_dir = os.path.join('build/', app['id'])
|
build_dir = os.path.join('build', app['id'])
|
||||||
repotype = app['Repo Type']
|
repotype = app['Repo Type']
|
||||||
|
|
||||||
if repotype not in ('git', 'git-svn', 'hg', 'bzr'):
|
if repotype not in ('git', 'git-svn', 'hg', 'bzr'):
|
||||||
@ -187,7 +187,7 @@ def check_repomanifest(app, branch=None):
|
|||||||
build_dir = os.path.join('build', 'srclib', app['Repo'])
|
build_dir = os.path.join('build', 'srclib', app['Repo'])
|
||||||
repotype = common.getsrclibvcs(app['Repo'])
|
repotype = common.getsrclibvcs(app['Repo'])
|
||||||
else:
|
else:
|
||||||
build_dir = os.path.join('build/', app['id'])
|
build_dir = os.path.join('build', app['id'])
|
||||||
repotype = app['Repo Type']
|
repotype = app['Repo Type']
|
||||||
|
|
||||||
# Set up vcs interface and make sure we have the latest code...
|
# Set up vcs interface and make sure we have the latest code...
|
||||||
@ -250,7 +250,7 @@ def check_repotrunk(app, branch=None):
|
|||||||
build_dir = os.path.join('build', 'srclib', app['Repo'])
|
build_dir = os.path.join('build', 'srclib', app['Repo'])
|
||||||
repotype = common.getsrclibvcs(app['Repo'])
|
repotype = common.getsrclibvcs(app['Repo'])
|
||||||
else:
|
else:
|
||||||
build_dir = os.path.join('build/', app['id'])
|
build_dir = os.path.join('build', app['id'])
|
||||||
repotype = app['Repo Type']
|
repotype = app['Repo Type']
|
||||||
|
|
||||||
if repotype not in ('git-svn', ):
|
if repotype not in ('git-svn', ):
|
||||||
@ -318,7 +318,7 @@ def check_changed_subdir(app):
|
|||||||
if app['Repo Type'] == 'srclib':
|
if app['Repo Type'] == 'srclib':
|
||||||
build_dir = os.path.join('build', 'srclib', app['Repo'])
|
build_dir = os.path.join('build', 'srclib', app['Repo'])
|
||||||
else:
|
else:
|
||||||
build_dir = os.path.join('build/', app['id'])
|
build_dir = os.path.join('build', app['id'])
|
||||||
|
|
||||||
if not os.path.isdir(build_dir):
|
if not os.path.isdir(build_dir):
|
||||||
return None
|
return None
|
||||||
@ -346,7 +346,7 @@ def fetch_autoname(app, tag):
|
|||||||
if app['Repo Type'] == 'srclib':
|
if app['Repo Type'] == 'srclib':
|
||||||
app_dir = os.path.join('build', 'srclib', app['Repo'])
|
app_dir = os.path.join('build', 'srclib', app['Repo'])
|
||||||
else:
|
else:
|
||||||
app_dir = os.path.join('build/', app['id'])
|
app_dir = os.path.join('build', app['id'])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
vcs = common.getvcs(app["Repo Type"], app["Repo"], app_dir)
|
vcs = common.getvcs(app["Repo Type"], app["Repo"], app_dir)
|
||||||
|
@ -197,7 +197,7 @@ def main():
|
|||||||
count)
|
count)
|
||||||
alldownloads += count
|
alldownloads += count
|
||||||
lst.append("ALL " + str(alldownloads))
|
lst.append("ALL " + str(alldownloads))
|
||||||
with open('stats/total_downloads_app.txt', 'w') as f:
|
with open(os.path.join('stats', 'total_downloads_app.txt'), 'w') as f:
|
||||||
f.write('# Total downloads by application, since October 2011\n')
|
f.write('# Total downloads by application, since October 2011\n')
|
||||||
for line in sorted(lst):
|
for line in sorted(lst):
|
||||||
f.write(line + '\n')
|
f.write(line + '\n')
|
||||||
@ -207,7 +207,7 @@ def main():
|
|||||||
count = appsvercount[appver]
|
count = appsvercount[appver]
|
||||||
lst.append(appver + " " + str(count))
|
lst.append(appver + " " + str(count))
|
||||||
|
|
||||||
with open('stats/total_downloads_app_version.txt', 'w') as f:
|
with open(os.path.join('stats', 'total_downloads_app_version.txt'), 'w') as f:
|
||||||
f.write('# Total downloads by application and version, '
|
f.write('# Total downloads by application and version, '
|
||||||
'since October 2011\n')
|
'since October 2011\n')
|
||||||
for line in sorted(lst):
|
for line in sorted(lst):
|
||||||
@ -221,7 +221,7 @@ def main():
|
|||||||
if rtype == 'srclib':
|
if rtype == 'srclib':
|
||||||
rtype = common.getsrclibvcs(app['Repo'])
|
rtype = common.getsrclibvcs(app['Repo'])
|
||||||
repotypes[rtype] += 1
|
repotypes[rtype] += 1
|
||||||
with open('stats/repotypes.txt', 'w') as f:
|
with open(os.path.join('stats', 'repotypes.txt'), 'w') as f:
|
||||||
for rtype, count in repotypes.most_common():
|
for rtype, count in repotypes.most_common():
|
||||||
f.write(rtype + ' ' + str(count) + '\n')
|
f.write(rtype + ' ' + str(count) + '\n')
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ def main():
|
|||||||
if checkmode.startswith('Tags '):
|
if checkmode.startswith('Tags '):
|
||||||
checkmode = checkmode[:4]
|
checkmode = checkmode[:4]
|
||||||
ucms[checkmode] += 1
|
ucms[checkmode] += 1
|
||||||
with open('stats/update_check_modes.txt', 'w') as f:
|
with open(os.path.join('stats', 'update_check_modes.txt'), 'w') as f:
|
||||||
for checkmode, count in ucms.most_common():
|
for checkmode, count in ucms.most_common():
|
||||||
f.write(checkmode + ' ' + str(count) + '\n')
|
f.write(checkmode + ' ' + str(count) + '\n')
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ def main():
|
|||||||
for app in metaapps:
|
for app in metaapps:
|
||||||
for category in app['Categories']:
|
for category in app['Categories']:
|
||||||
ctgs[category] += 1
|
ctgs[category] += 1
|
||||||
with open('stats/categories.txt', 'w') as f:
|
with open(os.path.join('stats', 'categories.txt'), 'w') as f:
|
||||||
for category, count in ctgs.most_common():
|
for category, count in ctgs.most_common():
|
||||||
f.write(category + ' ' + str(count) + '\n')
|
f.write(category + ' ' + str(count) + '\n')
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ def main():
|
|||||||
continue
|
continue
|
||||||
for antifeature in app['AntiFeatures']:
|
for antifeature in app['AntiFeatures']:
|
||||||
afs[antifeature] += 1
|
afs[antifeature] += 1
|
||||||
with open('stats/antifeatures.txt', 'w') as f:
|
with open(os.path.join('stats', 'antifeatures.txt'), 'w') as f:
|
||||||
for antifeature, count in afs.most_common():
|
for antifeature, count in afs.most_common():
|
||||||
f.write(antifeature + ' ' + str(count) + '\n')
|
f.write(antifeature + ' ' + str(count) + '\n')
|
||||||
|
|
||||||
@ -265,21 +265,21 @@ def main():
|
|||||||
for app in metaapps:
|
for app in metaapps:
|
||||||
license = app['License']
|
license = app['License']
|
||||||
licenses[license] += 1
|
licenses[license] += 1
|
||||||
with open('stats/licenses.txt', 'w') as f:
|
with open(os.path.join('stats', 'licenses.txt'), 'w') as f:
|
||||||
for license, count in licenses.most_common():
|
for license, count in licenses.most_common():
|
||||||
f.write(license + ' ' + str(count) + '\n')
|
f.write(license + ' ' + str(count) + '\n')
|
||||||
|
|
||||||
# Write list of disabled apps...
|
# Write list of disabled apps...
|
||||||
logging.info("Processing disabled apps...")
|
logging.info("Processing disabled apps...")
|
||||||
disabled = [a['id'] for a in allmetaapps if a['Disabled']]
|
disabled = [a['id'] for a in allmetaapps if a['Disabled']]
|
||||||
with open('stats/disabled_apps.txt', 'w') as f:
|
with open(os.path.join('stats', 'disabled_apps.txt'), 'w') as f:
|
||||||
for appid in sorted(disabled):
|
for appid in sorted(disabled):
|
||||||
f.write(appid + '\n')
|
f.write(appid + '\n')
|
||||||
|
|
||||||
# Write list of latest apps added to the repo...
|
# Write list of latest apps added to the repo...
|
||||||
logging.info("Processing latest apps...")
|
logging.info("Processing latest apps...")
|
||||||
latest = knownapks.getlatest(10)
|
latest = knownapks.getlatest(10)
|
||||||
with open('stats/latestapps.txt', 'w') as f:
|
with open(os.path.join('stats', 'latestapps.txt'), 'w') as f:
|
||||||
for appid in latest:
|
for appid in latest:
|
||||||
f.write(appid + '\n')
|
f.write(appid + '\n')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user