]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - _auto_deps.py
Note that servers of happiness only applies to immutable files for the moment
[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                   # Needed for SFTP. pyasn1 is needed by twisted.conch in Twisted >= 9.0.
32                   "pycrypto >= 2.0.1",
33                   "pyasn1 >= 0.0.8a",
34
35                   # Will be needed to test web apps, but not yet. See #1001.
36                   #"windmill >= 1.3",
37                   ]
38
39 # Sqlite comes built into Python >= 2.5, and is provided by the "pysqlite"
40 # distribution for Python 2.4.
41 import sys
42 if sys.version_info < (2, 5):
43     # pysqlite v2.0.5 was shipped in Ubuntu 6.06 LTS "dapper" and Nexenta NCP 1.
44     install_requires.append("pysqlite >= 2.0.5")
45
46 ## The following block is commented-out because there is not currently a pywin32 package which
47 ## can be easy_install'ed and also which actually makes "import win32api" succeed.
48 ## See http://sourceforge.net/tracker/index.php?func=detail&aid=1799934&group_id=78018&atid=551954
49 ## Users have to manually install pywin32 on Windows before installing Tahoe.
50 ##import platform
51 ##if platform.system() == "Windows":
52 ##    # Twisted requires pywin32 if it is going to offer process management functionality, or if
53 ##    # it is going to offer iocp reactor.  We currently require process management.  It would be
54 ##    # better if Twisted would declare that it requires pywin32 if it is going to offer process
55 ##    # management.  That is twisted ticket #3238 -- http://twistedmatrix.com/trac/ticket/3238 .
56 ##    # On the other hand, Tahoe also depends on pywin32 for getting free disk space statistics
57 ##    # (although that is not a hard requirement: if win32api can't be imported then we don't
58 ##    # rely on having the disk stats).
59 ##    install_requires.append('pywin32')
60
61 if hasattr(sys, 'frozen'): # for py2exe
62     install_requires=[]
63
64 def require_python_version():
65     import sys, platform
66
67     # we require 2.4.4 on non-UCS-2, non-Redhat builds to avoid <http://www.python.org/news/security/PSF-2006-001/>
68     # we require 2.4.3 on non-UCS-2 Redhat, because 2.4.3 is common on Redhat-based distros and will have patched the above bug
69     # we require at least 2.4.2 in any case to avoid a bug in the base64 module: <http://bugs.python.org/issue1171487>
70     if sys.maxunicode == 65535:
71         if sys.version_info < (2, 4, 2) or sys.version_info[0] > 2:
72             raise NotImplementedError("Tahoe-LAFS current requires Python v2.4.2 or greater "
73                                       "for a UCS-2 build (but less than v3), not %r" %
74                                       (sys.version_info,))
75     elif platform.platform().lower().find('redhat') >= 0:
76         if sys.version_info < (2, 4, 3) or sys.version_info[0] > 2:
77             raise NotImplementedError("Tahoe-LAFS current requires Python v2.4.3 or greater "
78                                       "on Redhat-based distributions (but less than v3), not %r" %
79                                       (sys.version_info,))
80     else:
81         if sys.version_info < (2, 4, 4) or sys.version_info[0] > 2:
82             raise NotImplementedError("Tahoe-LAFS current requires Python v2.4.4 or greater "
83                                       "for a non-UCS-2 build (but less than v3), not %r" %
84                                       (sys.version_info,))
85
86 def require_auto_deps():
87     """
88     The purpose of this function is to raise a pkg_resources exception if any of the
89     requirements can't be imported.  This is just to give earlier and more explicit error
90     messages, as opposed to waiting until the source code tries to import some module from one
91     of these packages and gets an ImportError.  This function gets called from
92     src/allmydata/__init__.py .
93     """
94     require_python_version()
95
96     import pkg_resources
97     for requirement in install_requires:
98         try:
99             pkg_resources.require(requirement)
100         except pkg_resources.DistributionNotFound:
101             # there is no .egg-info present for this requirement, which
102             # either means that it isn't installed, or it is installed in a
103             # way that pkg_resources can't find it (but regular python
104             # might).  There are several older Linux distributions which
105             # provide our dependencies just fine, but they don't ship
106             # .egg-info files. Note that if there *is* an .egg-info file,
107             # but it shows a too-old version, then we'll get a
108             # VersionConflict error instead of DistributionNotFound.
109             pass
110
111 def get_package_versions_from_setuptools():
112     import pkg_resources
113     return dict([(p.project_name, (p.version, p.location)) for p in pkg_resources.require('allmydata-tahoe')])