Commits

Ronald Oussoren committed 5724b71

Explicitly test semi-standalone builds

Semi-standalone builds should be tested as well, the bootstrap
code is slightly different after all.

  • Participants
  • Parent commits dc73a58

Comments (0)

Files changed (3)

File py2app_tests/basic_app/main.py

             m = getattr(m, k)
         print (m.__name__)
 
+def print_path():
+    print(sys.path)
 
 while True:
     line = sys.stdin.readline()

File py2app_tests/test_basic_app.py

         ln = p.stdout.readline()
         self.assertEqual(ln.strip(), B("decimal"))
 
-        if '--alias' not in self.py2app_args:
+        can_import_stdlib = False
+        if '--alias' in self.py2app_args:
+            can_import_stdlib = True
+
+        if '--semi-standalone' in self.py2app_args:
+            can_import_stdlib = True
+
+        if sys.prefix.startswith('/System/'):
+            can_import_stdlib = True
+
+        if not can_import_stdlib:
             # Not a dependency of the module (stdlib):
-            p.stdin.write('import_module("xmllib")\n'.encode('latin1'))
+            p.stdin.write('import_module("xdrlib")\n'.encode('latin1'))
             p.stdin.flush()
             ln = p.stdout.readline().decode('utf-8')
             self.assertTrue(ln.strip().startswith("* import failed"), ln)
 
-        # Not a dependency of the module (external):
-        p.stdin.write('import_module("py2app")\n'.encode('latin1'))
-        p.stdin.flush()
-        ln = p.stdout.readline().decode('utf-8')
-        self.assertTrue(ln.strip().startswith("* import failed"), ln)
+        else:
+            p.stdin.write('import_module("xdrlib")\n'.encode('latin1'))
+            p.stdin.flush()
+            ln = p.stdout.readline()
+            self.assertEqual(ln.strip(), B("xdrlib"))
+
+        if sys.prefix.startswith('/System'):
+            # py2app is included as part of the system install
+            p.stdin.write('import_module("py2app")\n'.encode('latin1'))
+            p.stdin.flush()
+            ln = p.stdout.readline().decode('utf-8')
+            self.assertEqual(ln.strip(), B("py2app"))
+
+
+        else:
+            # Not a dependency of the module (external):
+            p.stdin.write('import_module("py2app")\n'.encode('latin1'))
+            p.stdin.flush()
+            ln = p.stdout.readline().decode('utf-8')
+            self.assertTrue(ln.strip().startswith("* import failed"), ln)
 
         p.stdin.close()
         p.stdout.close()
 class TestBasicAliasApp (TestBasicApp):
     py2app_args = [ '--alias', ]
 
+class TestBasicSemiStandaloneApp (TestBasicApp):
+    py2app_args = [ '--semi-standalone', ]
+
 if __name__ == "__main__":
     unittest.main()
 

File py2app_tests/test_basic_plugin.py

             raise AssertionError("Creating basic_plugin bundle failed")
 
         p = subprocess.Popen([
-            'cc'] +  get_config_var('LDFLAGS').split() + [ 
+            'gcc'] +  get_config_var('LDFLAGS').split() + [ 
                 '-o', 'bundle_loader', os.path.join(DIR_NAME, 'bundle_loader.m'), 
                 '-framework', 'Foundation'],
             stdout=subprocess.PIPE,
 class TestBasicAliasPlugin (TestBasicPlugin):
     py2app_args = [ '--alias' ]
 
+class TestBasicSemiStandalonePlugin (TestBasicPlugin):
+    py2app_args = [ '--semi-standalone' ]
+
 if __name__ == "__main__":
     unittest.main()