From: Zooko O'Whielacronx Date: Tue, 22 Jan 2008 15:35:38 +0000 (-0700) Subject: setup: simplify the setup by removing the "tahoe dependencies" fake project X-Git-Url: https://git.rkrishnan.org/vdrive/%5B/%5D%20/uri/pb.xhtml?a=commitdiff_plain;h=1f2e3fc912bb897ea22713ec07032167d93fb2b3;p=tahoe-lafs%2Ftahoe-lafs.git setup: simplify the setup by removing the "tahoe dependencies" fake project Now we use "./setup.py develop" to ensure that changes to our source code are immediately used without requiring a "make" step. This simplification will hopefully pave the way for easier py2exe and py2app, solving the "Unit tests test the installed version" bug (#145), and perhaps also #164 and #176. This patch also conditionalizes the use of setuptools_darcs on the absence of a PKG-INFO file, which is part of fixing #263. --- diff --git a/Makefile b/Makefile index d71ba68d..025cd7f1 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # this Makefile requires GNU make -default: simple-build +default: build PYTHON=python PATHSEP=$(shell python -c 'import os ; print os.pathsep') @@ -46,18 +46,11 @@ endif TRIAL=PYTHONUNBUFFERED=1 $(TRIALCMD) --rterrors $(REACTOROPT) -build-auto-deps: check-deps - mkdir -p "$(SUPPORTLIB)" - @echo PYTHONPATH="$(PYTHONPATH)$(PATHSEP)$(SUPPORTLIB)$(PATHSEP)" \ - $(PYTHON) misc/dependencies/setup.py install --prefix="$(SUPPORT)" - @PYTHONPATH="$(PYTHONPATH)$(PATHSEP)$(SUPPORTLIB)$(PATHSEP)" \ - $(PYTHON) misc/dependencies/setup.py install --prefix="$(SUPPORT)" || \ - ( echo "Build of Tahoe's bundled, automatically built dependent libraries failed -- please see docs/install.html for instructions." && false ) - # The following target is here because I don't know how to tell the buildmaster -# to start instructing his slaves to "build-auto-deps" instead of instructing -# them to "build-deps". --Z -build-deps: build-auto-deps +# to start instructing his slaves to "build" instead of instructing them to +# "build-deps". --Z +build-deps: + echo "This is done automatically (by delegating to setuptools) now." EGGSPATH = $(shell $(PYTHON) misc/find-dep-eggs.py) show-eggspath: @@ -103,15 +96,13 @@ make-version: $(MAKE) build touch .built -simple-build: build-auto-deps build - src/allmydata/_version.py: $(MAKE) make-version build: src/allmydata/_version.py - @echo $(PYTHON) ./setup.py build_ext -i $(INCLUDE_DIRS_ARG) $(LIBRARY_DIRS_ARG) && chmod +x bin/tahoe - @( $(PYTHON) ./setup.py build_ext -i $(INCLUDE_DIRS_ARG) $(LIBRARY_DIRS_ARG) && chmod +x bin/tahoe ) || \ - ( echo "Build of Allmydata-Tahoe failed -- please see docs/install.html for instructions." && false ) + mkdir -p "$(SUPPORTLIB)" + PYTHONPATH="$(PYTHONPATH)$(PATHSEP)$(SUPPORTLIB)$(PATHSEP)" \ + $(PYTHON) ./setup.py develop install --prefix="$(SUPPORT)" # 'make install' will do the following: # build+install tahoe (probably to /usr/lib/pythonN.N/site-packages) diff --git a/calcdeps.py b/calcdeps.py deleted file mode 100644 index 81fb148d..00000000 --- a/calcdeps.py +++ /dev/null @@ -1,27 +0,0 @@ -import os - -miscdeps=os.path.join('misc', 'dependencies') -dependency_links=[os.path.join(miscdeps, t) for t in os.listdir(miscdeps) if t.endswith(".tar")] - -# By adding a web page to the dependency_links we are able to put new packages -# up there and have them be automatically discovered by existing copies of the -# tahoe source when that source was built. -dependency_links.append("http://allmydata.org/trac/tahoe/wiki/Dependencies") - -install_requires=["zfec >= 1.3.0", - "foolscap >= 0.2.3", - "simplejson >= 1.7.3", - "pycryptopp >= 0.2.9", - "nevow >= 0.6.0", - "zope.interface >= 3.1.0", - ] - -if __name__ == '__main__': - print "install_requires:" - for ir in install_requires: - print " ", ir - print - print "dependency_links:" - for dl in dependency_links: - print " ", dl - print diff --git a/misc/dependencies/setup.py b/misc/dependencies/setup.py deleted file mode 100644 index ae024d19..00000000 --- a/misc/dependencies/setup.py +++ /dev/null @@ -1,50 +0,0 @@ -#! /usr/bin/env python - -# N.B.: this expects to run from the top of the source tree - -import sys, os - -miscdeps=os.path.join('misc', 'dependencies') - -# Dapper ships with older versions of Twisted (2.2.0) and Nevow (0.6.0), and -# (unlike newer distributions) they are not installed with .egg meta-data -# directories. As a result, they are invisible to setuptools. When the -# 'build-deps' target thus builds Nevow, it will fail unless Twisted-2.4.0 or -# newer is available, so Dapper users must install a newer Twisted before -# running 'make build-deps'. In addition, through some not-yet-understood -# quirk of setuptools, if that newer Twisted is in /usr/local/lib , somehow -# the build still manages to pick up the old version from /usr/lib . It turns -# out that importing twisted now, before use_setuptools() is called, causes -# setuptools to stick with the correct (newer) Twisted. This causes an error -# if Twisted is not installed before you run 'make build-deps', but having -# Twisted at this point is a requirement anyways. - -import twisted - -try: - from ez_setup import use_setuptools -except ImportError: - pass -else: - if 'cygwin' in sys.platform.lower(): - min_version='0.6c6' - else: - # foolscap uses a module-level os.urandom() during import, which - # breaks inside older setuptools' sandboxing. 0.6c4 is the first - # version which fixed this problem. - min_version='0.6c4' - download_base = "file:"+os.path.join('misc', 'dependencies')+os.path.sep - use_setuptools(min_version=min_version, - download_base=download_base, - download_delay=0, to_dir=miscdeps) - -from setuptools import setup - -from calcdeps import install_requires, dependency_links - -setup(name='tahoe-deps', - version="1", - install_requires=install_requires, - dependency_links=dependency_links, - zip_safe=False - ) diff --git a/setup.py b/setup.py index 2ca9c88c..044605d4 100644 --- a/setup.py +++ b/setup.py @@ -8,29 +8,21 @@ # # See the docs/about.html file for licensing information. -import sys, re, os - -miscdeps=os.path.join('misc', 'dependencies') +import os, re, sys try: from ez_setup import use_setuptools except ImportError: pass else: + # On cygwin there was a permissions error that was fixed in 0.6c6. (Also # foolscap uses a module-level os.urandom() during import, which breaks # inside older setuptools' sandboxing. 0.6c4 is the first version which - # fixed this problem. On cygwin there was a different problem -- a - # permissions error -- that was fixed in 0.6c6. - min_version='0.6c6' - download_base = "file:"+os.path.join('misc', 'dependencies')+os.path.sep - use_setuptools(min_version=min_version, - download_base=download_base, - download_delay=0, to_dir=miscdeps) + # fixed this problem.) + use_setuptools(min_version='0.6c6') from setuptools import Extension, find_packages, setup -from calcdeps import install_requires, dependency_links - trove_classifiers=[ "Development Status :: 3 - Alpha", "Environment :: Console", @@ -66,13 +58,13 @@ trove_classifiers=[ VERSIONFILE = "src/allmydata/_version.py" verstr = "unknown" -VSRE = re.compile("^verstr = ['\"]([^'\"]*)['\"]", re.M) try: verstrline = open(VERSIONFILE, "rt").read() except EnvironmentError: pass # Okay, there is no version file. else: - mo = VSRE.search(verstrline) + VSRE = r"^verstr = ['\"]([^'\"]*)['\"]" + mo = re.search(VSRE, verstrline, re.M) if mo: verstr = mo.group(1) else: @@ -80,12 +72,21 @@ else: raise RuntimeError("if %s.py exists, it is required to be well-formed" % (VERSIONFILE,)) LONG_DESCRIPTION=\ -"""Welcome to the AllMyData "tahoe" project. This project implements a secure, -distributed, fault-tolerant storage grid under a Free Software licence. +"""Welcome to the Tahoe project, a secure, decentralized, fault-tolerant +filesystem. All of the source code is available under a Free Software, Open +Source licence. + +This filesystem is encrypted and spread over multiple peers in such a way that +it remains available even when some of the peers are unavailable, +malfunctioning, or malicious.""" -The basic idea is that the data in this storage grid is spread over all -participating nodes, using an algorithm that can recover the data even if a -majority of the nodes are no longer available.""" +miscdeps=os.path.join(os.getcwd(), 'misc', 'dependencies') +dependency_links=[os.path.join(miscdeps, t) for t in os.listdir(miscdeps) if t.endswith(".tar")] + +# By adding a web page to the dependency_links we are able to put new packages +# up there and have them be automatically discovered by existing copies of the +# tahoe source when that source was built. +dependency_links.append("http://allmydata.org/trac/tahoe/wiki/Dependencies") setup_requires = [] @@ -95,12 +96,20 @@ setup_requires = [] # http://pypi.python.org/pypi/darcsver setup_requires.append('darcsver >= 1.0.0') -# setuptools_darcs is required only if you want to use "./setup.py sdist", -# "./setup.py bdist", and the other "dist" commands -- it is necessary for them -# to produce complete distributions, which need to include all files that are -# under darcs revision control. +# setuptools_darcs is required to produce complete distributions (such as with +# "sdist" or "bdist_egg"), unless there is a PKG-INFO file present which shows +# that this is itself a source distribution. # http://pypi.python.org/pypi/setuptools_darcs -setup_requires.append('setuptools_darcs >= 1.0.5') +if not os.path.exists('PKG-INFO'): + setup_requires.append('setuptools_darcs >= 1.0.5') + +install_requires=["zfec >= 1.3.0", + "foolscap >= 0.2.3", + "simplejson >= 1.7.3", + "pycryptopp >= 0.2.9", + "nevow >= 0.6.0", + "zope.interface >= 3.1.0", + ] setup(name='allmydata-tahoe', version=verstr,