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