From d332c4c3c3eb7d65140f2094a36fdf9a1f2c254a Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Sun, 29 May 2005 00:17:22 +0000 Subject: 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 --- pkg_resources.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'pkg_resources.py') diff --git a/pkg_resources.py b/pkg_resources.py index ecc10dd8..b7826c4b 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -13,15 +13,15 @@ The package resource API is designed to work with normal filesystem packages, method. """ __all__ = [ - 'register_loader_type', 'get_provider', 'IResourceProvider', + 'register_loader_type', 'get_provider', 'IResourceProvider','PathMetadata', 'ResourceManager', 'AvailableDistributions', 'require', 'resource_string', 'resource_stream', 'resource_filename', 'set_extraction_path', - 'cleanup_resources', 'parse_requirements', 'parse_version', - 'compatible_platforms', 'get_platform', 'IMetadataProvider', - 'ResolutionError', 'VersionConflict', 'DistributionNotFound', + 'cleanup_resources', 'parse_requirements', 'ensure_directory', + 'compatible_platforms', 'get_platform', 'IMetadataProvider','parse_version', + 'ResolutionError', 'VersionConflict', 'DistributionNotFound','EggMetadata', 'InvalidOption', 'Distribution', 'Requirement', 'yield_lines', '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 @@ -342,7 +342,7 @@ class ResourceManager: extract_path = self.extraction_path extract_path = extract_path or os.path.expanduser('~/.python-eggs') target_path = os.path.join(extract_path, archive_name, *names) - _ensure_directory(target_path) + ensure_directory(target_path) self.cached_files.append(target_path) return target_path @@ -791,7 +791,7 @@ def find_on_path(importer,path_item): if path_item.lower().endswith('.egg'): # unpacked egg yield Distribution.from_filename( - egg_path, metadata=PathMetadata( + path_item, metadata=PathMetadata( path_item,os.path.join(path_item,'EGG-INFO') ) ) @@ -1310,7 +1310,7 @@ def _find_adapter(registry, ob): return registry[t] -def _ensure_directory(path): +def ensure_directory(path): dirname = os.path.dirname(path) if not os.path.isdir(dirname): os.makedirs(dirname) -- cgit v1.2.1