diff options
-rw-r--r-- | CHANGES.txt | 12 | ||||
-rwxr-xr-x | README.txt | 25 | ||||
-rw-r--r-- | distribute.egg-info/entry_points.txt | 2 | ||||
-rw-r--r-- | distribute_setup.py | 32 | ||||
-rw-r--r-- | docs/conf.py | 2 | ||||
-rw-r--r-- | pkg_resources.py | 15 | ||||
-rwxr-xr-x | release.sh | 2 | ||||
-rwxr-xr-x | setup.py | 4 | ||||
-rw-r--r-- | tests/test_distribute_setup.py | 12 |
9 files changed, 75 insertions, 31 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index c3a5299a..3aceb5ac 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -3,6 +3,18 @@ CHANGES ======= ----- +0.6.7 +----- + +* Issue 64: use_setuptools no longer rebuilds the distribute egg every + time it is run +* use_setuptools now properly respects the requested version +* use_setuptools will no longer try to import a distribute egg for the + wrong Python version +* Issue 74: no_fake should be True by default. +* Issue 72: avoid a bootstrapping issue with easy_install -U + +----- 0.6.6 ----- @@ -107,9 +107,9 @@ Source installation Download the source tarball, uncompress it, then run the install command:: - $ curl -O http://pypi.python.org/packages/source/d/distribute/distribute-0.6.6.tar.gz - $ tar -xzvf distribute-0.6.6.tar.gz - $ cd distribute-0.6.6 + $ curl -O http://pypi.python.org/packages/source/d/distribute/distribute-0.6.7.tar.gz + $ tar -xzvf distribute-0.6.7.tar.gz + $ cd distribute-0.6.7 $ python setup.py install --------------------------- @@ -196,16 +196,21 @@ Install FAQ - **How does Distribute interacts with zc.buildout?** - You can use Distribute in your zc.buildout. + You can use Distribute in your zc.buildout. *The only thing* you need to do + is use the bootstrap at `http://python-distribute.org/bootstrap.py`. Run + that bootstrap and ``bin/buildout`` (and all other buildout-generated + scripts) will transparently use distribute instead of setuptools. You do + not need a specific buildout release. - Although you have to run a specific `bootstrap.py` file that is available - at `http://python-distribute.org/bootstrap.py`. The code is located at + A shared eggs directory is no problem (since 0.6.6): the setuptools egg is + left in place unmodified. So other buildouts that do not yet use the new + bootstrap continue to work just fine. And there is no need to list + ``distribute`` somewhere in your eggs: using the bootstrap is enough. + + The source code for the bootstrap script is located at `http://bitbucket.org/tarek/buildout-distribute`. - Beware that if you use a shared eggs folder with buildout, you need to - switch all buildouts that use it to distribute. This is due to the fact - that the setuptools eggs located in the shared folder will be replaced - by a fake one, alongside distribute. + ----------------------------- Feedback and getting involved diff --git a/distribute.egg-info/entry_points.txt b/distribute.egg-info/entry_points.txt index 0aaa28c0..f4b74da0 100644 --- a/distribute.egg-info/entry_points.txt +++ b/distribute.egg-info/entry_points.txt @@ -32,7 +32,7 @@ depends.txt = setuptools.command.egg_info:warn_depends_obsolete [console_scripts] easy_install = setuptools.command.easy_install:main -easy_install-2.5 = setuptools.command.easy_install:main +easy_install-2.6 = setuptools.command.easy_install:main [setuptools.file_finders] svn_cvs = setuptools.command.sdist:_default_revctrl diff --git a/distribute_setup.py b/distribute_setup.py index 72853356..de7b1f6d 100644 --- a/distribute_setup.py +++ b/distribute_setup.py @@ -84,7 +84,7 @@ def _install(tarball): os.chdir(old_wd) -def _build_egg(tarball, to_dir): +def _build_egg(egg, tarball, to_dir): # extracting the tarball tmpdir = tempfile.mkdtemp() log.warn('Extracting in %s', tmpdir) @@ -104,27 +104,28 @@ def _build_egg(tarball, to_dir): log.warn('Building a Distribute egg in %s', to_dir) _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir) - # returning the result - for file in os.listdir(to_dir): - if fnmatch.fnmatch(file, 'distribute-%s*.egg' % DEFAULT_VERSION): - return os.path.join(to_dir, file) - - raise IOError('Could not build the egg.') finally: os.chdir(old_wd) + # returning the result + log.warn(egg) + if not os.path.exists(egg): + raise IOError('Could not build the egg.') def _do_download(version, download_base, to_dir, download_delay): - tarball = download_setuptools(version, download_base, - to_dir, download_delay) - egg = _build_egg(tarball, to_dir) + egg = os.path.join(to_dir, 'distribute-%s-py%d.%d.egg' + % (version, sys.version_info[0], sys.version_info[1])) + if not os.path.exists(egg): + tarball = download_setuptools(version, download_base, + to_dir, download_delay) + _build_egg(egg, tarball, to_dir) sys.path.insert(0, egg) import setuptools setuptools.bootstrap_install_from = egg def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, - to_dir=os.curdir, download_delay=15, no_fake=False): + to_dir=os.curdir, download_delay=15, no_fake=True): # making sure we use the absolute path to_dir = os.path.abspath(to_dir) was_imported = 'pkg_resources' in sys.modules or \ @@ -134,7 +135,7 @@ def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, import pkg_resources if not hasattr(pkg_resources, '_distribute'): if not no_fake: - fake_setuptools() + _fake_setuptools() raise ImportError except ImportError: return _do_download(version, download_base, to_dir, download_delay) @@ -159,7 +160,8 @@ def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, return _do_download(version, download_base, to_dir, download_delay) finally: - _create_fake_setuptools_pkg_info(to_dir) + if not no_fake: + _create_fake_setuptools_pkg_info(to_dir) def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, delay=15): @@ -319,7 +321,7 @@ def _patch_egg_dir(path): def _before_install(): log.warn('Before install bootstrap.') - fake_setuptools() + _fake_setuptools() def _under_prefix(location): @@ -340,7 +342,7 @@ def _under_prefix(location): return True -def fake_setuptools(): +def _fake_setuptools(): log.warn('Scanning installed packages') try: import pkg_resources diff --git a/docs/conf.py b/docs/conf.py index a0506322..794e728c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,7 +48,7 @@ copyright = u'2009, The fellowship of the packaging' # built documents. # # The short X.Y version. -version = '0.6.6' +version = '0.6.7' # The full version, including alpha/beta/rc tags. release = '0.6.4' diff --git a/pkg_resources.py b/pkg_resources.py index 49c26620..31d83554 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -21,7 +21,14 @@ except NameError: from sets import ImmutableSet as frozenset # capture these to bypass sandboxing -from os import utime, rename, unlink, mkdir +from os import utime +try: + from os import mkdir, rename, unlink + WRITE_SUPPORT = True +except ImportError: + # no write support, probably under GAE + WRITE_SUPPORT = False + from os import open as os_open from os.path import isdir, split @@ -36,6 +43,8 @@ _distribute = True def _bypass_ensure_directory(name, mode=0777): # Sandbox-bypassing version of ensure_directory() + if not WRITE_SUPPORT: + raise IOError('"os.mkdir" not supported on this platform.') dirname, filename = split(name) if dirname and filename and not isdir(dirname): _bypass_ensure_directory(dirname) @@ -1332,6 +1341,10 @@ class ZipProvider(EggProvider): timestamp = time.mktime(date_time) try: + if not WRITE_SUPPORT: + raise IOError('"os.rename" and "os.unlink" are not supported ' + 'on this platform') + real_path = manager.get_cache_path( self.egg_name, self._parts(zip_path) ) @@ -1,5 +1,5 @@ #!/bin/sh -export VERSION="0.6.6" +export VERSION="0.6.7" # tagging hg tag $VERSION @@ -36,7 +36,7 @@ init_path = convert_path('setuptools/command/__init__.py') exec(open(init_path).read(), d) SETUP_COMMANDS = d['__all__'] -VERSION = "0.6.6" +VERSION = "0.6.7" from setuptools import setup, find_packages scripts = [] @@ -73,7 +73,7 @@ dist = setup( license="PSF or ZPL", long_description = open('README.txt').read() + open('CHANGES.txt').read(), keywords = "CPAN PyPI distutils eggs package management", - url = "http://pypi.python.org/pypi/distribute", + url = "http://packages.python.org/distribute", test_suite = 'setuptools.tests', src_root = src_root, packages = find_packages(), diff --git a/tests/test_distribute_setup.py b/tests/test_distribute_setup.py index 4c9079a7..4151587f 100644 --- a/tests/test_distribute_setup.py +++ b/tests/test_distribute_setup.py @@ -57,5 +57,17 @@ class TestSetup(unittest.TestCase): distribute_setup.python_cmd = _faked _install(self.tarball) + def test_use_setuptools(self): + self.assertEquals(use_setuptools(), None) + + # make sure fake_setuptools is not called by default + import pkg_resources + del pkg_resources._distribute + def fake_setuptools(*args): + raise AssertionError + + pkg_resources._fake_setuptools = fake_setuptools + use_setuptools() + if __name__ == '__main__': unittest.main() |