r46902 - works on py3

hawkowl-TA+aISz0psMTMxyoc4vAAJOcrHinNvQL0E9HWUfgJXw@public.gmane.org
Newsgroups gmane.comp.python.twisted.commits
Message-ID <[email protected]>
Author: hawkowl
Date: Thu Mar  3 18:42:33 2016
New Revision: 46902

Modified:
   branches/sdist-use-7985-3/setup3.py
   branches/sdist-use-7985-3/twisted/python/dist.py
   branches/sdist-use-7985-3/twisted/python/dist3.py

Log:
works on py3

Modified: branches/sdist-use-7985-3/setup3.py
==============================================================================
--- branches/sdist-use-7985-3/setup3.py	(original)
+++ branches/sdist-use-7985-3/setup3.py	Thu Mar  3 18:42:33 2016
@@ -11,7 +11,10 @@
 
 import sys
 import os
+
+from setuptools import setup, find_packages
 from setuptools.command.build_py import build_py
+from setuptools.command.install_scripts import install_scripts
 
 
 class PickyBuildPy(build_py):
@@ -28,24 +31,34 @@
 
 
 
-def main():
-    from setuptools import setup, find_packages
+class PickyInstallScripts(install_scripts):
+
+    def write_script(self, script_name, contents, mode="t", *ignored):
+        from twisted.python.dist3 import portedScripts
+        if script_name in portedScripts:
+            return super(PickyInstallScripts, self).write_script(script_name, contents, mode=mode)
 
+
+
+def main():
     # Make sure the to-be-installed version of Twisted is used, if available,
     # since we're importing from it:
     if os.path.exists('twisted'):
         sys.path.insert(0, '.')
 
-    from twisted.python.dist import STATIC_PACKAGE_METADATA
+    from twisted.python.dist import STATIC_PACKAGE_METADATA, getScripts
 
     args = STATIC_PACKAGE_METADATA.copy()
     args.update(dict(
-        cmd_class={'build_py': PickyBuildPy},
+        cmd_class={
+            'build_py': PickyBuildPy,
+            'install_scripts': PickyInstallScripts,
+        },
         packages=find_packages(),
         install_requires=["zope.interface >= 4.0.2"],
         zip_safe=False,
         include_package_data=True,
-        scripts=['bin/trial', 'bin/twistd'],
+        scripts=getScripts(),
     ))
 
     setup(**args)

Modified: branches/sdist-use-7985-3/twisted/python/dist.py
==============================================================================
--- branches/sdist-use-7985-3/twisted/python/dist.py	(original)
+++ branches/sdist-use-7985-3/twisted/python/dist.py	Thu Mar  3 18:42:33 2016
@@ -255,8 +255,8 @@
     for specialExclusion in ['.svn', '_preamble.py', '_preamble.pyc']:
         if specialExclusion in thingies:
             thingies.remove(specialExclusion)
-    return filter(os.path.isfile,
-                  [os.path.join(scriptdir, x) for x in thingies])
+    return list(filter(os.path.isfile,
+                       [os.path.join(scriptdir, x) for x in thingies]))
 
 
 ## Helpers and distutil tweaks

Modified: branches/sdist-use-7985-3/twisted/python/dist3.py
==============================================================================
--- branches/sdist-use-7985-3/twisted/python/dist3.py	(original)
+++ branches/sdist-use-7985-3/twisted/python/dist3.py	Thu Mar  3 18:42:33 2016
@@ -499,3 +499,5 @@
 ]
 
 modulesToInstall = modules + testModules + almostModules
+
+portedScripts = ["bin/trial", "bin/twistd"]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.