summaryrefslogtreecommitdiff
path: root/setuptools/command/develop.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/command/develop.py')
-rwxr-xr-xsetuptools/command/develop.py60
1 files changed, 30 insertions, 30 deletions
diff --git a/setuptools/command/develop.py b/setuptools/command/develop.py
index 129184ca..368b64fe 100755
--- a/setuptools/command/develop.py
+++ b/setuptools/command/develop.py
@@ -1,11 +1,14 @@
-from setuptools.command.easy_install import easy_install
-from distutils.util import convert_path, subst_vars
-from pkg_resources import Distribution, PathMetadata, normalize_path
+from distutils.util import convert_path
from distutils import log
from distutils.errors import DistutilsError, DistutilsOptionError
-import os, sys, setuptools, glob
+import os
+import glob
+from pkg_resources import Distribution, PathMetadata, normalize_path
+from setuptools.command.easy_install import easy_install
from setuptools.compat import PY3
+import setuptools
+
class develop(easy_install):
"""Set up package for development"""
@@ -34,53 +37,50 @@ class develop(easy_install):
self.egg_path = None
easy_install.initialize_options(self)
self.setup_path = None
- self.always_copy_from = '.' # always copy eggs installed in curdir
-
-
+ self.always_copy_from = '.' # always copy eggs installed in curdir
def finalize_options(self):
ei = self.get_finalized_command("egg_info")
if ei.broken_egg_info:
- raise DistutilsError(
- "Please rename %r to %r before using 'develop'"
- % (ei.egg_info, ei.broken_egg_info)
- )
+ template = "Please rename %r to %r before using 'develop'"
+ args = ei.egg_info, ei.broken_egg_info
+ raise DistutilsError(template % args)
self.args = [ei.egg_name]
-
-
-
easy_install.finalize_options(self)
self.expand_basedirs()
self.expand_dirs()
# pick up setup-dir .egg files only: no .egg-info
self.package_index.scan(glob.glob('*.egg'))
- self.egg_link = os.path.join(self.install_dir, ei.egg_name+'.egg-link')
+ self.egg_link = os.path.join(self.install_dir, ei.egg_name +
+ '.egg-link')
self.egg_base = ei.egg_base
if self.egg_path is None:
self.egg_path = os.path.abspath(ei.egg_base)
target = normalize_path(self.egg_base)
- if normalize_path(os.path.join(self.install_dir, self.egg_path)) != target:
+ egg_path = normalize_path(os.path.join(self.install_dir,
+ self.egg_path))
+ if egg_path != target:
raise DistutilsOptionError(
"--egg-path must be a relative path from the install"
- " directory to "+target
- )
+ " directory to " + target
+ )
# Make a distribution for the package's source
self.dist = Distribution(
target,
PathMetadata(target, os.path.abspath(ei.egg_info)),
- project_name = ei.egg_name
+ project_name=ei.egg_name
)
- p = self.egg_base.replace(os.sep,'/')
- if p!= os.curdir:
- p = '../' * (p.count('/')+1)
+ 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):
+ 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))
@@ -106,7 +106,8 @@ class develop(easy_install):
ei_cmd = self.get_finalized_command("egg_info")
self.egg_path = build_path
self.dist.location = build_path
- self.dist._provider = PathMetadata(build_path, ei_cmd.egg_info) # XXX
+ # XXX
+ self.dist._provider = PathMetadata(build_path, ei_cmd.egg_info)
else:
# Without 2to3 inplace works fine:
self.run_command('egg_info')
@@ -123,21 +124,21 @@ class develop(easy_install):
# create an .egg-link in the installation dir, pointing to our egg
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 = open(self.egg_link, "w")
f.write(self.egg_path + "\n" + self.setup_path)
f.close()
# postprocess the installed distro, fixing up .pth, installing scripts,
# and handling requirements
self.process_distribution(None, self.dist, not self.no_deps)
-
def uninstall_link(self):
if os.path.exists(self.egg_link):
log.info("Removing %s (link to %s)", self.egg_link, self.egg_base)
egg_link_file = open(self.egg_link)
contents = [line.rstrip() for line in egg_link_file]
egg_link_file.close()
- if contents not in ([self.egg_path], [self.egg_path, self.setup_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:
@@ -151,7 +152,7 @@ class develop(easy_install):
def install_egg_scripts(self, dist):
if dist is not self.dist:
# Installing a dependency, so fall back to normal behavior
- return easy_install.install_egg_scripts(self,dist)
+ return easy_install.install_egg_scripts(self, dist)
# create wrapper scripts in the script dir, pointing to dist.scripts
@@ -162,8 +163,7 @@ class develop(easy_install):
for script_name in self.distribution.scripts or []:
script_path = os.path.abspath(convert_path(script_name))
script_name = os.path.basename(script_path)
- f = open(script_path,'rU')
+ f = open(script_path, 'rU')
script_text = f.read()
f.close()
self.install_script(dist, script_name, script_text, script_path)
-