summaryrefslogtreecommitdiff
path: root/setuptools/command
diff options
context:
space:
mode:
authorphillip.eby <phillip.eby@6015fed2-1504-0410-9fe1-9d1591cc4771>2007-02-23 20:27:29 +0000
committerphillip.eby <phillip.eby@6015fed2-1504-0410-9fe1-9d1591cc4771>2007-02-23 20:27:29 +0000
commita16c9820d87a010ae4733e38bd36233da0541e69 (patch)
tree27492b14c9922c9594362319c5c6e8e5d5962e90 /setuptools/command
parent6c54e2f8fe041d4f8d864566abec61673c01c0d4 (diff)
downloadpython-setuptools-a16c9820d87a010ae4733e38bd36233da0541e69.tar.gz
Add --local-snapshots-ok flag, to allow building eggs from projects
installed using "setup.py develop". git-svn-id: http://svn.python.org/projects/sandbox/trunk/setuptools@53876 6015fed2-1504-0410-9fe1-9d1591cc4771
Diffstat (limited to 'setuptools/command')
-rwxr-xr-xsetuptools/command/develop.py26
-rwxr-xr-xsetuptools/command/easy_install.py10
2 files changed, 18 insertions, 18 deletions
diff --git a/setuptools/command/develop.py b/setuptools/command/develop.py
index 8199b9f..b5fadc8 100755
--- a/setuptools/command/develop.py
+++ b/setuptools/command/develop.py
@@ -31,7 +31,7 @@ class develop(easy_install):
self.uninstall = None
self.egg_path = None
easy_install.initialize_options(self)
-
+ self.setup_path = None
@@ -61,6 +61,7 @@ class develop(easy_install):
" directory to "+target
)
+
# Make a distribution for the package's source
self.dist = Distribution(
target,
@@ -68,16 +69,15 @@ class develop(easy_install):
project_name = ei.egg_name
)
-
-
-
-
-
-
-
-
-
-
+ p = self.egg_base.replace(os.sep,'/')
+ if p!= os.curdir:
+ p = '../' * (p.count('/')+1)
+ self.setup_path = p
+ p = normalize_path(os.path.join(self.install_dir, self.egg_path, p))
+ if p != normalize_path(os.curdir):
+ raise DistutilsOptionError(
+ "Can't get a consistent path to setup script from"
+ " installation directory", p, normalize_path(os.curdir))
def install_for_development(self):
@@ -95,7 +95,7 @@ class develop(easy_install):
log.info("Creating %s (link to %s)", self.egg_link, self.egg_base)
if not self.dry_run:
f = open(self.egg_link,"w")
- f.write(self.egg_path)
+ f.write(self.egg_path + "\n" + self.setup_path)
f.close()
# postprocess the installed distro, fixing up .pth, installing scripts,
# and handling requirements
@@ -106,7 +106,7 @@ class develop(easy_install):
if os.path.exists(self.egg_link):
log.info("Removing %s (link to %s)", self.egg_link, self.egg_base)
contents = [line.rstrip() for line in file(self.egg_link)]
- if contents != [self.egg_path]:
+ if contents not in ([self.egg_path], [self.egg_path, self.setup_path]):
log.warn("Link points to %s: uninstall aborted", contents)
return
if not self.dry_run:
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 9b2fcca..ba03aae 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -70,18 +70,18 @@ class easy_install(Command):
('editable', 'e', "Install specified packages in editable form"),
('no-deps', 'N', "don't install dependencies"),
('allow-hosts=', 'H', "pattern(s) that hostnames must match"),
+ ('local-snapshots-ok', 'l', "allow building eggs from local checkouts"),
]
boolean_options = [
'zip-ok', 'multi-version', 'exclude-scripts', 'upgrade', 'always-copy',
'delete-conflicting', 'ignore-conflicts-at-my-risk', 'editable',
- 'no-deps',
+ 'no-deps', 'local-snapshots-ok',
]
negative_opt = {'always-unzip': 'zip-ok'}
create_index = PackageIndex
-
def initialize_options(self):
- self.zip_ok = None
+ self.zip_ok = self.local_snapshots_ok = None
self.install_dir = self.script_dir = self.exclude_scripts = None
self.index_url = None
self.find_links = None
@@ -177,7 +177,8 @@ class easy_install(Command):
self.find_links = self.find_links.split()
else:
self.find_links = []
-
+ if self.local_snapshots_ok:
+ self.package_index.scan_egg_links(self.shadow_path+sys.path)
self.package_index.add_find_links(self.find_links)
self.set_undefined_options('install_lib', ('optimize','optimize'))
if not isinstance(self.optimize,int):
@@ -202,7 +203,6 @@ class easy_install(Command):
self.outputs = []
-
def run(self):
if self.verbose<>self.distribution.verbose:
log.set_verbosity(self.verbose)