Commit d332c4c3 authored by PJ Eby's avatar PJ Eby

Add "easy_install" script that downloads distutils source (or .egg files)

and builds and installs them as eggs, with support for managing .pth files.
Built distributions are installed in individual subdirectories, so you can
either add the directory to a .pth (automatically done by default), or you
can use pkg_resources.require() to manage your dependencies explicitly.
Because each distribution is in its own directory (or .egg file),
uninstallation and clean upgrades are trivial, without the aid of any sort
of package manager.

--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041017
parent e15ee4d4
This diff is collapsed.
...@@ -13,15 +13,15 @@ The package resource API is designed to work with normal filesystem packages, ...@@ -13,15 +13,15 @@ The package resource API is designed to work with normal filesystem packages,
method. method.
""" """
__all__ = [ __all__ = [
'register_loader_type', 'get_provider', 'IResourceProvider', 'register_loader_type', 'get_provider', 'IResourceProvider','PathMetadata',
'ResourceManager', 'AvailableDistributions', 'require', 'resource_string', 'ResourceManager', 'AvailableDistributions', 'require', 'resource_string',
'resource_stream', 'resource_filename', 'set_extraction_path', 'resource_stream', 'resource_filename', 'set_extraction_path',
'cleanup_resources', 'parse_requirements', 'parse_version', 'cleanup_resources', 'parse_requirements', 'ensure_directory',
'compatible_platforms', 'get_platform', 'IMetadataProvider', 'compatible_platforms', 'get_platform', 'IMetadataProvider','parse_version',
'ResolutionError', 'VersionConflict', 'DistributionNotFound', 'ResolutionError', 'VersionConflict', 'DistributionNotFound','EggMetadata',
'InvalidOption', 'Distribution', 'Requirement', 'yield_lines', 'InvalidOption', 'Distribution', 'Requirement', 'yield_lines',
'get_importer', 'find_distributions', 'find_on_path', 'register_finder', 'get_importer', 'find_distributions', 'find_on_path', 'register_finder',
'split_sections', # 'glob_resources' 'split_sections', 'declare_namespace', 'register_namespace_handler',
] ]
import sys, os, zipimport, time, re, imp import sys, os, zipimport, time, re, imp
...@@ -342,7 +342,7 @@ class ResourceManager: ...@@ -342,7 +342,7 @@ class ResourceManager:
extract_path = self.extraction_path extract_path = self.extraction_path
extract_path = extract_path or os.path.expanduser('~/.python-eggs') extract_path = extract_path or os.path.expanduser('~/.python-eggs')
target_path = os.path.join(extract_path, archive_name, *names) target_path = os.path.join(extract_path, archive_name, *names)
_ensure_directory(target_path) ensure_directory(target_path)
self.cached_files.append(target_path) self.cached_files.append(target_path)
return target_path return target_path
...@@ -791,7 +791,7 @@ def find_on_path(importer,path_item): ...@@ -791,7 +791,7 @@ def find_on_path(importer,path_item):
if path_item.lower().endswith('.egg'): if path_item.lower().endswith('.egg'):
# unpacked egg # unpacked egg
yield Distribution.from_filename( yield Distribution.from_filename(
egg_path, metadata=PathMetadata( path_item, metadata=PathMetadata(
path_item,os.path.join(path_item,'EGG-INFO') path_item,os.path.join(path_item,'EGG-INFO')
) )
) )
...@@ -1310,7 +1310,7 @@ def _find_adapter(registry, ob): ...@@ -1310,7 +1310,7 @@ def _find_adapter(registry, ob):
return registry[t] return registry[t]
def _ensure_directory(path): def ensure_directory(path):
dirname = os.path.dirname(path) dirname = os.path.dirname(path)
if not os.path.isdir(dirname): if not os.path.isdir(dirname):
os.makedirs(dirname) os.makedirs(dirname)
......
...@@ -7,7 +7,7 @@ from distutils.version import LooseVersion ...@@ -7,7 +7,7 @@ from distutils.version import LooseVersion
setup( setup(
name="setuptools", name="setuptools",
version="0.0.1", version="0.3a1",
description="Distutils enhancements", description="Distutils enhancements",
author="Phillip J. Eby", author="Phillip J. Eby",
...@@ -22,6 +22,7 @@ setup( ...@@ -22,6 +22,7 @@ setup(
Require('PyUnit', None, 'unittest', "http://pyunit.sf.net/"), Require('PyUnit', None, 'unittest', "http://pyunit.sf.net/"),
], ],
packages = find_packages(), packages = find_packages(),
py_modules = ['pkg_resources'], py_modules = ['pkg_resources', 'easy_install'],
scripts = ['easy_install.py']
) )
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment