]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - _auto_deps.py
Alter directory.py to use parse_replace_arg()
[tahoe-lafs/tahoe-lafs.git] / _auto_deps.py
1 install_requires=[
2                   # we require newer versions of setuptools (actually
3                   # zetuptoolz) to build, but can handle older versions to run
4                   "setuptools >= 0.6c6",
5
6                   "zfec >= 1.1.0",
7
8                   # Feisty has simplejson 1.4
9                   "simplejson >= 1.4",
10
11                   "zope.interface",
12                   "Twisted >= 2.4.0",
13                   "foolscap[secure_connections] >= 0.4.1",
14                   "Nevow >= 0.6.0",
15                   ]
16
17 # pycryptopp v0.5.15 applied a patch from Wei Dai to fix an error in x86
18 # assembly on CPUs that can't do SSE2.  Fixes
19 # http://allmydata.org/trac/pycryptopp/ticket/24 .
20
21 # pycryptopp v0.5.14 patched the embedded Crypto++ to remove the usages of time
22 # functions, thus allowing mingw to build and link it for Python 2.6.  If I
23 # knew a convenient, reliable way to test whether the compiler that builds
24 # pycryptopp will be mingw then I guess I would add that, along with the Python
25 # >= v2.6 and the platform == Windows.  This is to work-around
26 # http://sourceforge.net/tracker/?func=detail&aid=2805976&group_id=2435&atid=302435
27 # .
28
29 # pycryptopp < 0.5 had a bug which, using a Microsoft compiler, or using some
30 # versions of g++ while linking against certain older versions of Crypto++,
31 # would cause incorrect AES results.
32 install_requires.append( "pycryptopp >= 0.5.15")
33
34 # Sqlite comes built into Python >= 2.5, and is provided by the "pysqlite"
35 # distribution for Python 2.4.
36 import sys
37 if sys.version_info < (2, 5):
38     # pysqlite v2.0.5 was shipped in Ubuntu 6.06 LTS "dapper" and Nexenta NCP 1.
39     install_requires.append("pysqlite >= 2.0.5")
40
41 ## The following block is commented-out because there is not currently a pywin32 package which
42 ## can be easy_install'ed and also which actually makes "import win32api" succeed.  Users have
43 ## to manually install pywin32 on Windows before installing Tahoe.
44 ##import platform
45 ##if platform.system() == "Windows":
46 ##    # Twisted requires pywin32 if it is going to offer process management functionality, or if
47 ##    # it is going to offer iocp reactor.  We currently require process management.  It would be
48 ##    # better if Twisted would declare that it requires pywin32 if it is going to offer process
49 ##    # management.  Then the specification and the evolution of Twisted's reliance on pywin32 can
50 ##    # be confined to the Twisted setup data, and Tahoe can remain blissfully ignorant about such
51 ##    # things as if a future version of Twisted requires a different version of pywin32, or if a
52 ##    # future version of Twisted implements process management without using pywin32 at all,
53 ##    # etc..  That is twisted ticket #3238 -- http://twistedmatrix.com/trac/ticket/3238 .  But
54 ##    # until Twisted does that, Tahoe needs to be non-ignorant of the following requirement:
55 ##    install_requires.append('pywin32')
56
57 if hasattr(sys, 'frozen'): # for py2exe
58     install_requires=[]
59
60 def require_python_2_with_working_base64():
61     import sys
62     if sys.version_info[0] != 2:
63         raise NotImplementedError("Tahoe-LAFS current requires Python v2.4.2 or greater (but less than v3), not %r" % (sys.version_info,))
64
65     # make sure we have a working base64.b32decode. The one in
66     # python2.4.[01] was broken.
67     nodeid_b32 = 't5g7egomnnktbpydbuijt6zgtmw4oqi5'
68     import base64
69     nodeid = base64.b32decode(nodeid_b32.upper())
70     if nodeid != "\x9fM\xf2\x19\xcckU0\xbf\x03\r\x10\x99\xfb&\x9b-\xc7A\x1d":
71         raise NotImplementedError("There is a bug in this base64 module: %r.  This was a known issue in Python v2.4.0 and v2.4.1 (http://bugs.python.org/issue1171487 ).  Tahoe-LAFS current requires Python v2.4.2 or greater (but less than v3).  The current Python version is %r" % (base64, sys.version_info,))
72
73 def require_auto_deps():
74     """
75     The purpose of this function is to raise a pkg_resources exception if any of the
76     requirements can't be imported.  This is just to give earlier and more explicit error
77     messages, as opposed to waiting until the source code tries to import some module from one
78     of these packages and gets an ImportError.  This function gets called from
79     src/allmydata/__init__.py .
80     """
81     require_python_2_with_working_base64()
82
83     import pkg_resources
84     for requirement in install_requires:
85         try:
86             pkg_resources.require(requirement)
87         except pkg_resources.DistributionNotFound:
88             # there is no .egg-info present for this requirement, which
89             # either means that it isn't installed, or it is installed in a
90             # way that pkg_resources can't find it (but regular python
91             # might).  There are several older Linux distributions which
92             # provide our dependencies just fine, but they don't ship
93             # .egg-info files. Note that if there *is* an .egg-info file,
94             # but it shows a too-old version, then we'll get a
95             # VersionConflict error instead of DistributionNotFound.
96             pass
97
98 def get_package_versions_from_setuptools():
99     import pkg_resources
100     return dict([(p.project_name, (p.version, p.location)) for p in pkg_resources.require('allmydata-tahoe')])