Anonymous committed 84b4202

Now cli.exe and gui.exe are generated at build time - win_script_wrapper.txt covers this case - refs #65

Comments (0)

Files changed (3)

+* Issue 65: cli.exe and gui.exe are not generated at build time,
+  depending on the platform in use.
 * Issue 67: Fixed doc typo (PEP 381/382) 
 * Distribute no longer shadows setuptools if we require a 0.7-series


 easy_install = setuptools.command.easy_install:main
-easy_install-2.5 = setuptools.command.easy_install:main
+easy_install-2.6 = setuptools.command.easy_install:main
 svn_cvs = setuptools.command.sdist:_default_revctrl
 #!/usr/bin/env python
 """Distutils setup file, used to install or test 'setuptools'"""
-import sys, os
+import sys
+import os
+import platform
 src_root = None
 if sys.version_info >= (3,):
 VERSION = "0.6.5"
 from setuptools import setup, find_packages
-import os
-import sys
+from setuptools.command.build_py import build_py as _build_py
 scripts = []
+# specific command that is used to generate windows .exe files
+class build_py(_build_py):
+    def build_package_data(self):
+        """Copy data files into build directory"""
+        lastdir = None
+        is_64 =  platform.architecture()[0] == '64bit'
+        for package, src_dir, build_dir, filenames in self.data_files:
+            for filename in filenames:
+                target = os.path.join(build_dir, filename)
+                self.mkpath(os.path.dirname(target))
+                srcfile = os.path.join(src_dir, filename)
+                outf, copied = self.copy_file(srcfile, target)
+                # creating cli.exe and gui.exe
+                if filename in ('gui-32.exe', 'cli-32.exe') and not is_64:
+                    exe_target = os.path.join(build_dir, filename.replace('-32.exe', '.exe'))
+                    self.copy_file(srcfile, exe_target)
+                if filename in ('gui-64.exe', 'cli-64.exe') and is_64:
+                    exe_target = os.path.join(build_dir, filename.replace('-64.exe', '.exe'))
+                    self.copy_file(srcfile, exe_target)
+                srcfile = os.path.abspath(srcfile)
+                if copied and srcfile in self.distribution.convert_2to3_doctests:
+                    self.__doctests_2to3.append(outf)
 # if we are installing Distribute using "python install"
 # we need to get setuptools out of the way
 def _easy_install_marker():
     Topic :: System :: Systems Administration
     Topic :: Utilities""".splitlines() if f.strip()],
     scripts = scripts,
+    cmdclass = {'build_py': build_py}
 if _being_installed():
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.