]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - src/allmydata/_auto_deps.py
5052ab85aca1cbea104df73c54fdb406bed60150
[tahoe-lafs/tahoe-lafs.git] / src / allmydata / _auto_deps.py
1 # Note: please minimize imports in this file. In particular, do not import
2 # any module from Tahoe-LAFS or its dependencies, and do not import any
3 # modules at all at global level. That includes setuptools and pkg_resources.
4 # It is ok to import modules from the Python Standard Library if they are
5 # always available, or the import is protected by try...except ImportError.
6
7 install_requires = [
8     # We require newer versions of setuptools (actually
9     # zetuptoolz) to build, but can handle older versions to run.
10     "setuptools >= 0.6c6",
11
12     "zfec >= 1.1.0",
13
14     # Feisty has simplejson 1.4
15     "simplejson >= 1.4",
16
17     # zope.interface >= 3.6.0 is required for Twisted >= 12.1.0.
18     # zope.interface 3.6.3 and 3.6.4 are incompatible with Nevow (#1435).
19     "zope.interface == 3.6.0, == 3.6.1, == 3.6.2, >= 3.6.5",
20
21     # * foolscap < 0.5.1 had a performance bug which spent O(N**2) CPU for
22     #   transferring large mutable files of size N.
23     # * foolscap < 0.6 is incompatible with Twisted 10.2.0.
24     # * foolscap 0.6.1 quiets a DeprecationWarning.
25     # * foolscap < 0.6.3 is incompatible with Twisted 11.1.0 and newer.
26     "foolscap >= 0.6.3",
27
28     # Needed for SFTP.
29     # pycrypto 2.2 doesn't work due to <https://bugs.launchpad.net/pycrypto/+bug/620253>
30     # pycrypto 2.4 doesn't work due to <https://bugs.launchpad.net/pycrypto/+bug/881130>
31     "pycrypto == 2.1.0, == 2.3, >= 2.4.1",
32
33     # <http://www.voidspace.org.uk/python/mock/>, 0.8.0 provides "call"
34     "mock >= 0.8.0",
35
36     # pycryptopp-0.6.0 includes ed25519
37     "pycryptopp >= 0.6.0",
38 ]
39
40 # Includes some indirect dependencies, but does not include allmydata.
41 # These are in the order they should be listed by --version, etc.
42 package_imports = [
43     # package name       module name
44     ('foolscap',         'foolscap'),
45     ('pycryptopp',       'pycryptopp'),
46     ('zfec',             'zfec'),
47     ('Twisted',          'twisted'),
48     ('Nevow',            'nevow'),
49     ('zope.interface',   'zope.interface'),
50     ('python',           None),
51     ('platform',         None),
52     ('pyOpenSSL',        'OpenSSL'),
53     ('simplejson',       'simplejson'),
54     ('pycrypto',         'Crypto'),
55     ('pyasn1',           'pyasn1'),
56     ('mock',             'mock'),
57 ]
58
59 # Dependencies for which we don't know how to get a version number at run-time.
60 not_import_versionable = [
61     'zope.interface',
62     'mock',
63     'pyasn1',
64     'pyasn1-modules',
65 ]
66
67 # Dependencies reported by pkg_resources that we can safely ignore.
68 ignorable = [
69     'argparse',
70     'pyutil',
71     'zbase32',
72     'distribute',
73     'twisted-web',
74     'twisted-core',
75     'twisted-conch',
76 ]
77
78 import sys
79
80 # Don't try to get the version number of setuptools in frozen builds, because
81 # that triggers 'site' processing that causes failures. Note that frozen
82 # builds still (unfortunately) import pkg_resources in .tac files, so the
83 # entry for setuptools in install_requires above isn't conditional.
84 if not hasattr(sys, 'frozen'):
85     package_imports.append(('setuptools', 'setuptools'))
86
87
88 # Splitting the dependencies for Windows and non-Windows helps to fix
89 # <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2249> and
90 # <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2028>.
91
92 if sys.platform == "win32":
93     install_requires += [
94         # * On Windows we need at least Twisted 9.0 to avoid an indirect
95         #   dependency on pywin32.
96         # * We also need Twisted 10.1 for the FTP frontend in order for
97         #   Twisted's FTP server to support asynchronous close.
98         # * When the cloud backend lands, it will depend on Twisted 10.2.0
99         #   which includes the fix to <https://twistedmatrix.com/trac/ticket/411>.
100         # * The SFTP frontend depends on Twisted 11.0.0 to fix the SSH server
101         #   rekeying bug <https://twistedmatrix.com/trac/ticket/4395>
102         # * We don't want Twisted >= 12.3.0 to avoid a dependency of its endpoints
103         #   code on pywin32. <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2028>
104         #
105         "Twisted == 11.0.0, == 11.1.0, == 12.0.0, == 12.1.0, == 12.2.0",
106
107         # * We need Nevow >= 0.9.33 to avoid a bug in Nevow's setup.py
108         #   which imported twisted at setup time.
109         # * We don't want Nevow 0.11 because that requires Twisted >= 13.0
110         #   which conflicts with the Twisted requirement above.
111         #   <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2291>
112         #
113         "Nevow == 0.9.33, == 0.10",
114
115         # pyasn1 is needed by twisted.conch in Twisted >= 9.0.
116         "pyasn1 >= 0.0.8a",
117     ]
118 else:
119     install_requires += [
120         # * On Linux we need at least Twisted 10.1.0 for inotify support
121         #   used by the drop-upload frontend.
122         # * Nevow 0.11.1 requires Twisted >= 13.0.0 so we might as well
123         #   require it directly; this helps to work around
124         #   <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2286>.
125         #   This also satisfies the requirements for the FTP and SFTP
126         #   frontends and cloud backend mentioned in the Windows section
127         #   above.
128         #
129         "Twisted >= 13.0.0",
130
131         # Nevow >= 0.11.1 can be installed using pip.
132         "Nevow >= 0.11.1",
133
134         "service-identity",         # this is needed to suppress complaints about being unable to verify certs
135         "characteristic >= 14.0.0", # latest service-identity depends on this version
136         "pyasn1 >= 0.1.4",          # latest pyasn1-modules depends on this version
137         "pyasn1-modules",           # service-identity depends on this
138     ]
139
140     package_imports += [
141         ('service-identity', 'service_identity'),
142         ('characteristic',   'characteristic'),
143         ('pyasn1-modules',   'pyasn1_modules'),
144     ]
145
146
147 # * pyOpenSSL is required in order for foolscap to provide secure connections.
148 #   Since foolscap doesn't reliably declare this dependency in a machine-readable
149 #   way, we need to declare a dependency on pyOpenSSL ourselves. Tahoe-LAFS does
150 #   not *directly* depend on pyOpenSSL.
151 #
152 # * pyOpenSSL >= 0.13 is needed in order to avoid
153 #   <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2005>.
154 #
155 # * pyOpenSSL >= 0.14 is built on the 'cryptography' package which depends
156 #   on 'cffi' (and indirectly several other packages). Unfortunately cffi
157 #   attempts to compile code dynamically, which causes problems on many systems.
158 #   It also depends on the libffi OS package which may not be installed.
159 #   <https://bitbucket.org/cffi/cffi/issue/109/enable-sane-packaging-for-cffi>
160 #   <https://bitbucket.org/cffi/cffi/issue/70/cant-install-cffi-using-pip-on-windows>
161 #
162 #   So, if pyOpenSSL 0.14 has *already* been installed and is importable, we
163 #   want to accept it; otherwise we ask for pyOpenSSL 0.13 or 0.13.1.
164 #   <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2193>
165 #
166 #   We don't rely on pkg_resources to tell us the installed pyOpenSSL version
167 #   number, because pkg_resources telling us that we have 0.14 is not sufficient
168 #   evidence that 0.14 will be the imported version (or will work correctly).
169 #   One possible reason why it might not be is explained in
170 #   <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1246#comment:6> and
171 #   <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1258>.
172
173 _can_use_pyOpenSSL_0_14 = False
174 try:
175     import OpenSSL
176     pyOpenSSL_ver = OpenSSL.__version__.split('.')
177     if int(pyOpenSSL_ver[0]) > 0 or int(pyOpenSSL_ver[1]) >= 14:
178         _can_use_pyOpenSSL_0_14 = True
179 except Exception:
180     pass
181
182 if _can_use_pyOpenSSL_0_14:
183     install_requires += [
184         # Although we checked for pyOpenSSL >= 0.14 above, we only actually
185         # need pyOpenSSL >= 0.13; requiring 0.14 here cannot help.
186         "pyOpenSSL >= 0.13",
187
188         # ... and now all the new stuff that pyOpenSSL 0.14 transitively
189         # depends on. We specify these explicitly because setuptools is
190         # bad at correctly resolving indirect dependencies (e.g. see
191         # <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2286>).
192         #
193         "cryptography",
194         "cffi >= 0.8",          # latest cryptography depends on this version
195         "six >= 1.4.1",         # latest cryptography depends on this version
196         "pycparser",            # cffi depends on this
197     ]
198
199     package_imports += [
200         ('cryptography',     'cryptography'),
201         ('cffi',             'cffi'),
202         ('six',              'six'),
203         ('pycparser',        'pycparser'),
204     ]
205 else:
206     install_requires += [
207         "pyOpenSSL == 0.13, == 0.13.1",
208     ]
209
210
211 # These are suppressed globally:
212
213 global_deprecation_messages = [
214     "BaseException.message has been deprecated as of Python 2.6",
215     "twisted.internet.interfaces.IFinishableConsumer was deprecated in Twisted 11.1.0: Please use IConsumer (and IConsumer.unregisterProducer) instead.",
216     "twisted.internet.interfaces.IStreamClientEndpointStringParser was deprecated in Twisted 14.0.0: This interface has been superseded by IStreamClientEndpointStringParserWithReactor.",
217 ]
218
219 # These are suppressed while importing dependencies:
220
221 deprecation_messages = [
222     "the sha module is deprecated; use the hashlib module instead",
223     "object.__new__\(\) takes no parameters",
224     "The popen2 module is deprecated.  Use the subprocess module.",
225     "the md5 module is deprecated; use hashlib instead",
226     "twisted.web.error.NoResource is deprecated since Twisted 9.0.  See twisted.web.resource.NoResource.",
227     "the sets module is deprecated",
228 ]
229
230 runtime_warning_messages = [
231     "Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.",
232 ]
233
234 warning_imports = [
235     'nevow',
236     'twisted.persisted.sob',
237     'twisted.python.filepath',
238     'Crypto.Hash.SHA',
239 ]