fix stab at a Cygwin port (aaaahh Windows!)

This gets `fdroid init` and `fdroid readmeta` working on Cygwin.
This commit is contained in:
Hans-Christoph Steiner 2016-03-15 11:30:27 +01:00
parent 8041e34957
commit 016fa78111
2 changed files with 15 additions and 5 deletions

View file

@ -128,10 +128,16 @@ def fill_config_defaults(thisconfig):
# find all installed JDKs for keytool, jarsigner, and JAVA[6-9]_HOME env vars # find all installed JDKs for keytool, jarsigner, and JAVA[6-9]_HOME env vars
if thisconfig['java_paths'] is None: if thisconfig['java_paths'] is None:
thisconfig['java_paths'] = dict() thisconfig['java_paths'] = dict()
for d in sorted(glob.glob('/usr/lib/jvm/j*[6-9]*') pathlist = []
+ glob.glob('/usr/java/jdk1.[6-9]*') pathlist += glob.glob('/usr/lib/jvm/j*[6-9]*')
+ glob.glob('/System/Library/Java/JavaVirtualMachines/1.[6-9].0.jdk') pathlist += glob.glob('/usr/java/jdk1.[6-9]*')
+ glob.glob('/Library/Java/JavaVirtualMachines/*jdk*[6-9]*')): pathlist += glob.glob('/System/Library/Java/JavaVirtualMachines/1.[6-9].0.jdk')
pathlist += glob.glob('/Library/Java/JavaVirtualMachines/*jdk*[6-9]*')
if os.getenv('JAVA_HOME') is not None:
pathlist += os.getenv('JAVA_HOME')
if os.getenv('PROGRAMFILES') is not None:
pathlist += glob.glob(os.path.join(os.getenv('PROGRAMFILES'), 'Java', 'jdk1.[6-9].*'))
for d in sorted(pathlist):
if os.path.islink(d): if os.path.islink(d):
continue continue
j = os.path.basename(d) j = os.path.basename(d)
@ -139,6 +145,7 @@ def fill_config_defaults(thisconfig):
for regex in [ for regex in [
r'^1\.([6-9])\.0\.jdk$', # OSX r'^1\.([6-9])\.0\.jdk$', # OSX
r'^jdk1\.([6-9])\.0_[0-9]+.jdk$', # OSX and Oracle tarball r'^jdk1\.([6-9])\.0_[0-9]+.jdk$', # OSX and Oracle tarball
r'^jdk1\.([6-9])\.0_[0-9]+$', # Oracle Windows
r'^jdk([6-9])-openjdk$', # Arch r'^jdk([6-9])-openjdk$', # Arch
r'^java-([6-9])-openjdk$', # Arch r'^java-([6-9])-openjdk$', # Arch
r'^java-([6-9])-jdk$', # Arch (oracle) r'^java-([6-9])-jdk$', # Arch (oracle)

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# #
# update.py - part of the FDroid server tools # init.py - part of the FDroid server tools
# Copyright (C) 2010-2013, Ciaran Gultnieks, ciaran@ciarang.com # Copyright (C) 2010-2013, Ciaran Gultnieks, ciaran@ciarang.com
# Copyright (C) 2013-2014 Daniel Martí <mvdan@mvdan.cc> # Copyright (C) 2013-2014 Daniel Martí <mvdan@mvdan.cc>
# Copyright (C) 2013 Hans-Christoph Steiner <hans@eds.org> # Copyright (C) 2013 Hans-Christoph Steiner <hans@eds.org>
@ -100,6 +100,9 @@ def main():
else: else:
# if neither --android-home nor the default sdk_path exist, prompt the user # if neither --android-home nor the default sdk_path exist, prompt the user
default_sdk_path = '/opt/android-sdk' default_sdk_path = '/opt/android-sdk'
if sys.platform == 'win32' or sys.platform == 'cygwin':
default_sdk_path = os.path.join(os.getenv('USERPROFILE'),
'AppData', 'Local', 'Android', 'android-sdk')
while not options.no_prompt: while not options.no_prompt:
try: try:
s = input('Enter the path to the Android SDK (' s = input('Enter the path to the Android SDK ('