r46901 - Packages!

mithrandi-TA+aISz0psMTMxyoc4vAAJOcrHinNvQL0E9HWUfgJXw@public.gmane.org
Newsgroups gmane.comp.python.twisted.commits
Message-ID <[email protected]>
Author: mithrandi
Date: Thu Mar  3 13:04:51 2016
New Revision: 46901

Modified:
   branches/sdist-use-7985-3/setup3.py

Log:
Packages!

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 13:04:51 2016
@@ -11,35 +11,38 @@
 
 import sys
 import os
-from distutils.command.sdist import sdist
+from setuptools.command.build_py import build_py
 
 
-class DisabledSdist(sdist):
+class PickyBuildPy(build_py):
     """
-    A version of the sdist command that does nothing.
+    A version of build_py that doesn't install the modules that aren't yet
+    ported to Python 3.
     """
-    def run(self):
-        sys.stderr.write(
-            "The sdist command only works with Python 2 at the moment.\n")
-        sys.exit(1)
+    def find_package_modules(self, package, package_dir):
+        from twisted.python.dist3 import modulesToInstall, testDataFiles
+        return [
+            module for module
+            in super(build_py, self).find_package_modules(package, package_dir)
+            if module in modulesToInstall or module in testDataFiles]
 
 
 
 def main():
-    from setuptools import setup
+    from setuptools import setup, find_packages
 
     # 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.dist3 import modulesToInstall, testDataFiles
     from twisted.python.dist import STATIC_PACKAGE_METADATA
 
     args = STATIC_PACKAGE_METADATA.copy()
     args.update(dict(
+        cmd_class={'build_py': PickyBuildPy},
+        packages=find_packages(),
         install_requires=["zope.interface >= 4.0.2"],
-        py_modules=modulesToInstall + testDataFiles,
         zip_safe=False,
         include_package_data=True,
         scripts=['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.