chiark / gitweb /
Make pre-commit hook pass after python3 switch
authorDaniel Martí <mvdan@mvdan.cc>
Mon, 4 Jan 2016 16:28:55 +0000 (17:28 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Thu, 10 Mar 2016 16:43:37 +0000 (16:43 +0000)
fdroidserver/init.py
fdroidserver/server.py
fdroidserver/update.py
tests/build.TestCase
tests/common.TestCase
tests/install.TestCase
tests/update.TestCase

index 3d8679ffced958593a9776efb2e2356bca14398a..4bed02c14f6ac2e04b8b9ae1d2c058ec3bad9bef 100644 (file)
@@ -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)
index 80fc24f01854a36df9ddd3e02807594716a0c936..dfa3a1a6819abd8a6569fc95a035f631339de95d 100644 (file)
@@ -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':
index 6a9bc0637697680271edd5a16b267d27d2f34bee..3dd8912b659da7f4ac31f4bb356e2df2290be2bb 100644 (file)
@@ -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)
 
index 0665bfffa7f41b3c2de249a7957b5fb74b046586..ddefb947f2abc4b3363a54560869b9de41f4cf4b 100755 (executable)
@@ -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):
index 32e7af7f468c38bf7d7a3e8b71b9426ff4bde610..4ce09cae33c9c50cf96c39858099fc799f19d06d 100755 (executable)
@@ -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()
index 2734f132b0298eb9e28ab0a5e397c86c3cb59f00..8cf8e08822765b8dc735efd46c85235b53f07ff4 100755 (executable)
@@ -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__":
index 07f5765428104daa6061c708352e0fc10b181fd9..d9d3ed0aa03d8a68de643f5d10711f7a5c94b702 100755 (executable)
@@ -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):