Diff of /setup.py [17c6bf] .. [82ddff] Maximize Restore

  Switch to side-by-side view

--- a/setup.py
+++ b/setup.py
@@ -5,18 +5,44 @@
 # 2. run the following command:
 #      python setup.py py2exe
 
+# to make a source tarball or zip (depending on your platform) from source:
+#   python setup.py sdist
+
+# The build process for bdist_wininst produces an improper installer.
+# It seems possible, if not likely, that bdist_rpm suffers the same problems.
+# I have explicitly removed support for them unless someone sends in a fix
+# for making them work.
+
+import sys
+
+if [i for i in sys.argv if 'wininst' in i or 'rpm' in i]:
+    print '''
+You seem to be attempting a bdist_wininst or bdist_rpm distribution creation.
+According to my experience, running the results of PyPE + bdist_wininst will
+muck up your Python installation (destroying readme.txt, etc.).  It seems
+possible, if not likely, that the bdist_rpm variant suffers from the same kind
+of problems.  You are likely better off using the 'python setup.py sdist'
+version, and packaging it up with some platform-specific tool.
+'''
+    sys.exit(1)
+
 from distutils.core import setup
-import pype
-try:
-    import py2exe
-except:
-    pass
+import __version__
+
+if 'py2exe' in sys.argv:
+    import pype
+    try:
+        import py2exe
+    except:
+        raise SystemExit("py2exe needs to be installed to create Windows binaries")
 import glob
 import os
 
-nam = "PyPE-win32"
-if pype.VS[-1] == 'u':
-    nam += '-unicode'
+nam = "PyPE"
+if sys.platform == 'win32' and 'py2exe' in sys.argv:
+    nam += "-win32"
+    if pype.VS[-1] == 'u':
+        nam += '-unicode'
 
 def glob_(path, extns):
     x = []
@@ -26,15 +52,19 @@
     
 samples = os.path.join('macros', 'samples')
 
-setup(name=nam,
-      version=pype.VERSION_,
-      windows=[{"script": "pype.py",
-                "icon_resources": [(1, os.path.join("icons", "pype.ico"))]}],
-      data_files=[('', glob.glob('*.txt')+\
-                   ['stc-styles.rc.cfg', 'readme.html']),
-                   ('icons', glob.glob(os.path.join('icons', '*.*'))),
-                   #('macros', glob.glob(os.path.join('macros', '*.py'))),
-                   (samples, glob_(samples, ('*.txt', '*.py')))],
-      options = {"py2exe": {"packages": ["encodings"],
-                            "compressed": 1}}
+setup(
+    name=nam,
+    version=__version__.VERSION_,
+    author="Josiah Carlson",
+    author_email="jcarlson@uci.edu",
+    
+    windows=[{"script": "pype.py",
+              "icon_resources": [(1, os.path.join("icons", "pype.ico"))]}],
+    data_files=[('', glob.glob('*.txt')+\
+                ['stc-styles.rc.cfg', 'readme.html', 'PKG-INFO', 'MANIFEST.in']),
+                ('icons', glob.glob(os.path.join('icons', '*.*'))),
+                #('macros', glob.glob(os.path.join('macros', '*.py'))),
+                (samples, glob_(samples, ('*.txt', '*.py')))],
+    options = {"py2exe": {"packages": ["encodings"],
+                          "compressed": 1}},
 )