1. Ronald Oussoren
  2. py2app

Commits

Ronald Oussoren  committed 41c1ed4

Refuse to install when the current platform is not OSX

Fixes #83

  • Participants
  • Parent commits 12b1c33
  • Branches default

Comments (0)

Files changed (2)

File doc/changelog.rst

View file
 
 py2app 0.8 is a feature release
 
+- Issue #83: Setup.py now refuses to install when the current
+  platform is not Mac OS X. 
+  
+  This makes it clear that the package is only supported on OSX and 
+  avoids confusing errors later on.
+
 - Issue #39: It is now possible to have subpackages on
   in the "packages" option of py2app.
 

File setup.py

View file
 
         finally:
             self.remove_from_sys_path()
+
+
+cmdclass = dict(
+    upload_docs=upload_docs,
+    test=test,
+)
+if sys.platform != 'darwinx':
+    msg = "This distribution is only supported on MacOSX"
+    from distutils.command import build, install
+    from setuptools.command import develop, build_ext, install_lib, build_py
+    from distutils.errors import DistutilsPlatformError
+
+
+    def create_command_subclass(base_class):
+        class subcommand (base_class):
+            def run(self):
+                raise DistutilsPlatformError(msg)
+        return subcommand
+
+    class no_test (test):
+        def run(self):
+            print("WARNING: %s\n"%(msg,))
+            print("SUMMARY: {'count': 0, 'fails': 0, 'errors': 0, 'xfails': 0, 'skip': 65, 'xpass': 0, 'message': msg }\n")
+
+    cmdclass['build'] = create_command_subclass(build.build)
+    cmdclass['test'] = no_test
+    cmdclass['install'] = create_command_subclass(install.install)
+    cmdclass['install_lib'] = create_command_subclass(install_lib.install_lib)
+    cmdclass['develop'] = create_command_subclass(develop.develop)
+    cmdclass['build_py'] = create_command_subclass(build_py.build_py)
+
 setup(
     # metadata
     name='py2app',
         "macholib>=1.5",
     ],
     tests_require=tests_require,
-    cmdclass=dict(
-        upload_docs=upload_docs,
-        test=test,
-    ),
+    cmdclass=cmdclass,
     packages=find_packages(exclude=['py2app_tests']),
     package_data={
         'py2app.recipes': [