From: Brian Warner Date: Wed, 12 Sep 2007 23:02:53 +0000 (-0700) Subject: packaging: move to setuptools X-Git-Tag: allmydata-tahoe-0.6.0~146 X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/class-simplejson.JSONDecoder-index.html?a=commitdiff_plain;h=1c27cc3ea828d6b56a0a12c7c82071082df8652a;p=tahoe-lafs%2Ftahoe-lafs.git packaging: move to setuptools --- diff --git a/Makefile b/Makefile index 34ee26af..0459c84f 100644 --- a/Makefile +++ b/Makefile @@ -55,43 +55,31 @@ TRIAL=$(PYTHON) -u "$(TRIALPATH)" --rterrors --reactor=$(REACTOR) show-instdir: @echo $(INSTDIR)/lib -PP=PYTHONPATH=$(PYTHONPATH) +#PP=PYTHONPATH=$(PYTHONPATH) .PHONY: make-version build make-version: $(PYTHON) misc/make-version.py "allmydata-tahoe" "src/allmydata/_version.py" -build: make-version build-zfec build-foolscap build-simplejson - $(PP) $(PYTHON) ./setup.py $(EXTRA_SETUP_ARGS) install --prefix="$(INSTDIR)" --install-lib="$(INSTDIR)/lib" --install-scripts="$(INSTDIR)/bin" +build: make-version + $(PP) $(PYTHON) ./setup.py build_ext -i -build-zfec: - cd src/zfec && \ - $(PP) $(PYTHON) ./setup.py $(EXTRA_SETUP_ARGS) install --single-version-externally-managed --prefix="$(INSTDIR)" --record="$(INSTDIR)/zfec_install.log" --install-lib="$(INSTDIR)/lib" --install-scripts="$(INSTDIR)/bin" +# 'make install' will do the following: +# build+install tahoe (probably to /usr/lib/pythonN.N/site-packages) -build-foolscap: - cd src/foolscap && \ - $(PP) $(PYTHON) ./setup.py $(EXTRA_SETUP_ARGS) install --prefix="$(INSTDIR)" --record="$(INSTDIR)/foolscap_install.log" --install-lib="$(INSTDIR)/lib" --install-scripts="$(INSTDIR)/bin" - -build-simplejson: - cd src/simplejson && \ - $(PP) $(PYTHON) ./setup.py $(EXTRA_SETUP_ARGS) install --single-version-externally-managed --prefix="$(INSTDIR)" --record="$(INSTDIR)/simplejson_install.log" --install-lib="$(INSTDIR)/lib" --install-scripts="$(INSTDIR)/bin" - -clean-zfec: - -cd src/zfec && $(PP) $(PYTHON) ./setup.py clean --all - rm -rf src/zfec/zfec.egg-info - rm -f src/zfec/setuptools-*.egg - find src/zfec -name '*.pyc' |xargs rm -f - -clean-simplejson: - -cd src/simplejson && $(PP) $(PYTHON) ./setup.py clean --all - rm -rf src/simplejson/simplejson.egg-info - rm -f src/simplejson/setuptools-*.egg - find src/simplejson -name '*.pyc' |xargs rm -f - -clean-foolscap: - -cd src/foolscap && $(PP) $(PYTHON) ./setup.py clean --all - find src/foolscap -name '*.pyc' |xargs rm -f +# 'make install PREFIX=/usr/local/stow/tahoe-N.N' will do the following: +# build+install tahoe to the given PREFIX +install: make-version +ifdef PREFIX + mkdir -p $(PREFIX) + $(PP) $(PYTHON) ./setup.py install \ + --single-version-externally-managed \ + --prefix=$(PREFIX) --record=./tahoe.files +else + $(PP) $(PYTHON) ./setup.py install \ + --single-version-externally-managed +endif # RUNNING @@ -120,15 +108,15 @@ stop-introducer: build # TESTING -.PHONY: test-all test test-foolscap test-figleaf figleaf-output +.PHONY: test-all test test-figleaf figleaf-output # you can use 'make test TEST=allmydata.test.test_introducer' to run just # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works # too. -TEST=allmydata zfec +TEST=allmydata REPORTER= -test-all: test-foolscap test +test-all: test # use 'make test REPORTER=--reporter=bwverbose' from buildbot, to supress the # ansi color sequences @@ -136,12 +124,6 @@ test-all: test-foolscap test test: build $(PP) $(TRIAL) $(REPORTER) $(TEST) -# foolscap tests need to be run in their own source dir, so that the paths to -# the .pyc files are correct (since some of the foolscap tests depend upon -# stack traces having actual source code in them, and they don't when the -# tests are run from the 'instdir' that the tahoe makefile uses). -test-foolscap: - cd src/foolscap && PYTHONPATH=$(ORIGPYTHONPATH) $(TRIAL) $(REPORTER) foolscap test-figleaf: build find $(INSTDIR) -name '*.pyc' |xargs rm @@ -156,7 +138,7 @@ figleaf-output: # coverage-html/index.html .PHONY: upload-figleaf .figleaf.el pyflakes count-lines check-memory -.PHONY: clean clean-zfec clean-simplejson clean-foolscap +.PHONY: clean # 'upload-figleaf' is meant to be run with an UPLOAD_TARGET=host:/dir setting ifdef UPLOAD_TARGET @@ -211,18 +193,13 @@ test-clean: find . |grep -v allfiles.tmp |sort >allfiles.tmp.new diff allfiles.tmp.old allfiles.tmp.new -clean: clean-zfec clean-foolscap clean-simplejson +clean: rm -rf build rm -f debian rm -rf instdir - rm -f `find src/allmydata -name '*.so'` - rm -f src/allmydata/_version.py + rm -f `find src/allmydata -name '*.so' -or -name '*.pyc'` + rm -rf allmydata_tahoe.egg-info -install: - cd src/zfec && python ./setup.py install && cd ../.. - cd src/foolscap && python ./setup.py install && cd ../.. - cd src/simplejson && python ./setup.py install && cd ../.. - python ./setup.py install # DEBIAN PACKAGING @@ -245,7 +222,7 @@ deb-edgy: $(MAKE) deb-ARCH ARCH=edgy TAHOE_ARCH=feisty # etch uses the feisty control files for now deb-etch: - $(MAKE) deb-ARCH ARCH=etch FOOLSCAP_ARCH=sid TAHOE_ARCH=feisty + $(MAKE) deb-ARCH ARCH=etch TAHOE_ARCH=feisty # we know how to handle the following debian architectures KNOWN_DEBIAN_ARCHES := sid feisty edgy etch @@ -260,9 +237,6 @@ is-known-debian-arch: /bin/true endif -ifndef FOOLSCAP_ARCH -FOOLSCAP_ARCH=$(ARCH) -endif ifndef TAHOE_ARCH TAHOE_ARCH=$(ARCH) endif diff --git a/README b/README index fb1bed8a..cfb060e4 100644 --- a/README +++ b/README @@ -118,15 +118,6 @@ gcc make python-dev python-twisted python-nevow python-pyopenssl". Feedback with details of other builds is greatly appreciated) -Tahoe uses a few additional libraries which are included in this source -distribution for convenience. These will be automatically built when you type -'make', but if you have separate installations of them you may wish to modify -the makefile to use those in preference to the included versions. They -include Foolscap (a secure remote-object-invocation library) and zfec -(erasure coding). There are also pieces of PyCrypto copied into -allmydata.Crypto, modified to provide a faster CTR-mode API. - - BUILDING: Just type 'make' in the top-level tahoe directory. This works on Windows @@ -138,7 +129,7 @@ BUILDING: If the desired version of 'python' is not already on your PATH, then type 'make PYTHON=/path/to/your/preferred/python'. - 'make test-all' runs the unit test suites. (This can take a long time on + 'make test' runs the unit test suites. (This can take a long time on slow computers. There are a lot of tests and some of them do a lot of public-key cryptography.) @@ -165,34 +156,32 @@ Running-In-Place Way. Choose one: directory to construct a debian package named 'allmydata-tahoe' which you can then install with dpkg. - The Python Way: - - Just run make install. (This works on cygwin and Windows, too.) + The Setuptools Way: - In case you want to configure the location or other install options you can - learn how it is done here: + Just run 'python setup.py install'. This will compile and install the Tahoe + code to a system-specific standard location (somewhere inside /usr/lib/ on + unix). It will also acquire and install many of the necessary dependencies + in the same place. (The dependency-checking can handle foolscap and zfec, + but you are still responsible for ensuring that twisted, nevow, and + pyopenssl are installed). - The Python Way is to execute "setup.py install" for each Python package. + To install it to a non-standard location, learn about the + "--single-version-externally-managed" flag, and visit + http://allmydata.org/trac/tahoe/wiki/Installing . - You'll need to run "setup.py install" four separate times, one for each of - the four subpackages (allmydata, foolscap, simplejson, and zfec). + The easy_install Way: - for PACKAGE in zfec foolscap simplejson; do - cd src/${PACKAGE} && python setup.py install && cd ../.. - done - - # the tahoe subpackage's setup.py script is in the root directory - PACKAGE=tahoe - python setup.py install + Tahoe is registered with the Python Package Index (PyPI), so the + 'easy_install' tool can download and install it for you. Just type + 'easy_install allmydata-tahoe' from any shell. That will download the most + recent Tahoe source tarball, unpack it in a temporary directory, install it + to the standard location, then download and install any easy_install-able + dependencies (like zfec and foolscap) that you need. The Running-In-Place Way: - The Running-In-Place Way is to add a directory to your PYTHONPATH. - - To run from a source tree (without installing first) just build it - (i.e. type 'make'), which will put all the necessary libraries into a local - directory named "./instdir/lib", which you can then add to your - PYTHONPATH . It will put executables into "./instdir/bin". + You can use Tahoe without installing it. Once you've built Tahoe then you + can execute "./bin/allmydata-tahoe". TESTING THAT IT IS PROPERLY INSTALLED diff --git a/setup.py b/setup.py index 50aeccb9..fcf76029 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ # http://allmydata.com/. import re, os.path -from distutils.core import Extension, setup +from setuptools import Extension, setup trove_classifiers=[ "Development Status :: 3 - Alpha", @@ -95,6 +95,17 @@ setup(name='allmydata-tahoe', package_data={ 'allmydata': ['web/*.xhtml', 'web/*.html', 'web/*.css'] }, classifiers=trove_classifiers, test_suite="allmydata.test", + install_requires=["zfec >= 1.0.3", + "foolscap >= 0.1.6", "simplejson", "nevow"], + dependency_links=["http://allmydata.org/trac/tahoe/wiki/Dependencies", + # this form is used when the unpacked source + # distribution is copied into our tree: + #"file:misc/dependencies/zfec-1.0.2/" + # and this form is used when we provide a tarball + #"file:misc/dependencies/zfec-1.0.2.tar.gz", + # The file: URL can start with either 'misc' or + # './misc' to get a relative path. + ], ext_modules=[ Extension("allmydata.Crypto.Cipher.AES", include_dirs=["src/allmydata/Crypto"],