From: Daniel Martí Date: Mon, 4 Jan 2016 16:28:55 +0000 (+0100) Subject: Make pre-commit hook pass after python3 switch X-Git-Tag: 0.7.0~86^2~35 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=ee9a296b64c2d5f0a3fa02ea03c1afe4512e5f9b;p=fdroidserver.git Make pre-commit hook pass after python3 switch --- diff --git a/fdroidserver/init.py b/fdroidserver/init.py index 3d8679ff..4bed02c1 100644 --- a/fdroidserver/init.py +++ b/fdroidserver/init.py @@ -102,8 +102,8 @@ def main(): default_sdk_path = '/opt/android-sdk' while not options.no_prompt: try: - s = raw_input('Enter the path to the Android SDK (' - + default_sdk_path + ') here:\n> ') + s = input('Enter the path to the Android SDK (' + + default_sdk_path + ') here:\n> ') except KeyboardInterrupt: print('') sys.exit(1) diff --git a/fdroidserver/server.py b/fdroidserver/server.py index 80fc24f0..dfa3a1a6 100644 --- a/fdroidserver/server.py +++ b/fdroidserver/server.py @@ -295,12 +295,12 @@ def main(): sftp = ssh.open_sftp() if os.path.basename(remotepath) \ not in sftp.listdir(os.path.dirname(remotepath)): - sftp.mkdir(remotepath, mode=0755) + sftp.mkdir(remotepath, mode=0o755) for repo_section in repo_sections: repo_path = os.path.join(remotepath, repo_section) if os.path.basename(repo_path) \ not in sftp.listdir(remotepath): - sftp.mkdir(repo_path, mode=0755) + sftp.mkdir(repo_path, mode=0o755) sftp.close() ssh.close() elif options.command == 'update': diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 6a9bc063..3dd8912b 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -1337,14 +1337,15 @@ def main(): # Generate latest apps data for widget if os.path.exists(os.path.join('stats', 'latestapps.txt')): data = '' - for line in file(os.path.join('stats', 'latestapps.txt')): - appid = line.rstrip() - data += appid + "\t" - app = apps[appid] - data += app.Name + "\t" - if app.icon is not None: - data += app.icon + "\t" - data += app.License + "\n" + with open(os.path.join('stats', 'latestapps.txt'), 'r') as f: + for line in f: + appid = line.rstrip() + data += appid + "\t" + app = apps[appid] + data += app.Name + "\t" + if app.icon is not None: + data += app.icon + "\t" + data += app.License + "\n" with open(os.path.join(repodirs[0], 'latestapps.dat'), 'w') as f: f.write(data) diff --git a/tests/build.TestCase b/tests/build.TestCase index 0665bfff..ddefb947 100755 --- a/tests/build.TestCase +++ b/tests/build.TestCase @@ -37,7 +37,7 @@ class BuildTest(unittest.TestCase): break return True else: - print 'no build-tools found: ' + build_tools + print('no build-tools found: ' + build_tools) return False def _find_all(self): diff --git a/tests/common.TestCase b/tests/common.TestCase index 32e7af7f..4ce09cae 100755 --- a/tests/common.TestCase +++ b/tests/common.TestCase @@ -37,7 +37,7 @@ class CommonTest(unittest.TestCase): break return True else: - print 'no build-tools found: ' + build_tools + print('no build-tools found: ' + build_tools) return False def _find_all(self): @@ -61,7 +61,7 @@ class CommonTest(unittest.TestCase): if self._set_build_tools(): self._find_all() else: - print 'no build-tools found: ' + build_tools + print('no build-tools found: ' + build_tools) def testIsApkDebuggable(self): config = dict() diff --git a/tests/install.TestCase b/tests/install.TestCase index 2734f132..8cf8e088 100755 --- a/tests/install.TestCase +++ b/tests/install.TestCase @@ -32,7 +32,7 @@ class InstallTest(unittest.TestCase): devices = fdroidserver.install.devices() self.assertIsInstance(devices, list, 'install.devices() did not return a list!') for device in devices: - self.assertIsInstance(device, basestring) + self.assertIsInstance(device, str) if __name__ == "__main__": diff --git a/tests/update.TestCase b/tests/update.TestCase index 07f57654..d9d3ed0a 100755 --- a/tests/update.TestCase +++ b/tests/update.TestCase @@ -59,7 +59,7 @@ class UpdateTest(unittest.TestCase): self.assertEquals(sig.decode('hex'), pysig.decode('hex'), "the length of the two sigs are different!") except TypeError as e: - print e + print(e) self.assertTrue(False, 'TypeError!') def testBadGetsig(self):