Ticket #3696: extras_require-3696-6.diff
File extras_require-3696-6.diff, 5.0 KB (added by , 6 years ago) |
---|
-
setup.py
diff --git setup.py setup.py index 26f052b..e63f1b5 100755
dependency resolution is disabled. 54 54 55 55 from twisted.python.dist import ( 56 56 STATIC_PACKAGE_METADATA, getDataFiles, getExtensions, getAllScripts, 57 getPackages, setup )57 getPackages, setup, EXTRAS_REQUIRE) 58 58 59 59 scripts = getAllScripts() 60 60 … … dependency resolution is disabled. 62 62 packages=getPackages('twisted'), 63 63 conditionalExtensions=getExtensions(), 64 64 scripts=scripts, 65 extras_require=EXTRAS_REQUIRE, 65 66 data_files=getDataFiles('twisted'), 66 67 **STATIC_PACKAGE_METADATA)) 67 68 -
twisted/python/dist.py
diff --git twisted/python/dist.py twisted/python/dist.py index 63b36b3..9122cd8 100644
twisted_subprojects = ["conch", "lore", "mail", "names", 49 49 "news", "pair", "runner", "web", 50 50 "words"] 51 51 52 # These are the actual package names and versions that will 53 # be used by extras_require. This is not passed to setup 54 # directly so that combinations of the packages can be created 55 # without the need to copy package names multiple times. 56 _extra_options = dict( 57 docs=['sphinx >= 1.2.2', 58 'pydoctor >= 0.5'], 59 dev=['twistedchecker >= 0.2.0', 60 'pyflakes >= 0.8.1', 61 'twisted-dev-tools >= 0.0.2'], 62 tls=['pyopenssl >= 0.11', 63 'service_identity', 64 'PyCrypto'], 65 conch=['gmpy', 66 'pyasn1'], 67 subunit=['python-subunit'], 68 soap=['soappy'], 69 serial=['pyserial'], 70 windows=['pywin32'], 71 osx=['pyobjc'] 72 ) 73 74 _platform_independent = [ 75 _extra_options['docs'], 76 _extra_options['dev'], 77 _extra_options['tls'], 78 _extra_options['conch'], 79 _extra_options['subunit'], 80 _extra_options['soap'], 81 _extra_options['serial'], 82 ] 83 84 # extras_require is a dictionary of items that can be passed to setup.py 85 # to install optional dependencies. For example, to install the optional 86 # dev dependencies one would type `pip install -e . "twisted[dev]"` 87 # This has been supported by setuptools since 0.5a4 88 EXTRAS_REQUIRE = { 89 'docs': _extra_options['docs'], 90 'dev': _extra_options['dev'], 91 'tls': _extra_options['tls'], 92 'conch': _extra_options['conch'], 93 'subunit': _extra_options['subunit'], 94 'soap': _extra_options['soap'], 95 'serial': _extra_options['serial'], 96 'all_non_plat': _platform_independent, 97 'windows_plat': [ 98 _extra_options['windows'], 99 _platform_independent 100 ], 101 'osx_plat': [ 102 _extra_options['osx'], 103 _platform_independent 104 ], 105 } 52 106 53 107 54 108 class ConditionalExtension(Extension): -
twisted/python/test/test_dist.py
diff --git twisted/python/test/test_dist.py twisted/python/test/test_dist.py index d2288ee..5d212ea 100644
Tests for parts of our release automation system. 9 9 import os 10 10 import sys 11 11 12 from distutils.coreimport Distribution12 from setuptools.dist import Distribution 13 13 14 14 from twisted.trial.unittest import TestCase 15 15 16 16 from twisted.python import dist 17 17 from twisted.python.dist import (get_setup_args, ConditionalExtension, 18 build_scripts_twisted)18 build_scripts_twisted, EXTRAS_REQUIRE) 19 19 from twisted.python.filepath import FilePath 20 20 21 21 … … class SetupTest(TestCase): 58 58 self.assertEqual(ext.define_macros, [("whatever", 2), ("WIN32", 1)]) 59 59 60 60 61 class OptionalDependenciesTests(TestCase): 62 """ 63 Tests for L{dist.EXTRA_REQUIRES} 64 65 Test whether or not the setuptools generates the correct Distribution 66 object when extra_requires are passed to it. As long as the distribution 67 object looks correct, it *should* generate the correct egg_info. 68 """ 69 def test_distributeTakesExtrasRequire(self): 70 """ 71 Test that setuptools' Distribution object can use extra_requires. 72 """ 73 attrs = dict(extras_require=EXTRAS_REQUIRE) 74 dist = Distribution(attrs) 75 self.assertEqual(dist.extras_require, EXTRAS_REQUIRE) 76 77 def test_extrasRequireDictContainsKeys(self): 78 """ 79 Test that the L{dist.EXTRA_REQUIRES} dictionary contains all of the 80 expected keys. 81 """ 82 self.assertIn('docs', EXTRAS_REQUIRE) 83 self.assertIn('dev', EXTRAS_REQUIRE) 84 self.assertIn('tls', EXTRAS_REQUIRE) 85 self.assertIn('conch', EXTRAS_REQUIRE) 86 self.assertIn('subunit', EXTRAS_REQUIRE) 87 self.assertIn('soap', EXTRAS_REQUIRE) 88 self.assertIn('serial', EXTRAS_REQUIRE) 89 self.assertIn('all_non_plat', EXTRAS_REQUIRE) 90 self.assertIn('windows_plat', EXTRAS_REQUIRE) 91 self.assertIn('osx_plat', EXTRAS_REQUIRE) 92 61 93 62 94 class GetExtensionsTest(TestCase): 63 95 """ -
new file twisted/topfiles/3696.misc
diff --git twisted/topfiles/3696.misc twisted/topfiles/3696.misc new file mode 100644 index 0000000..78e79d4
- + 1 Optional dependencies can be installed using the extra_requires facility provided by setuptools 2 No newline at end of file