aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/develop.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/command/develop.py')
-rwxr-xr-xsetuptools/command/develop.py85
1 files changed, 44 insertions, 41 deletions
diff --git a/setuptools/command/develop.py b/setuptools/command/develop.py
index f128b803..1d500040 100755
--- a/setuptools/command/develop.py
+++ b/setuptools/command/develop.py
@@ -1,9 +1,9 @@
from setuptools.command.easy_install import easy_install
-from distutils.util import convert_path
+from distutils.util import convert_path, subst_vars
from pkg_resources import Distribution, PathMetadata, normalize_path
from distutils import log
-from distutils.errors import *
-import sys, os, setuptools, glob
+from distutils.errors import DistutilsError, DistutilsOptionError
+import os, sys, setuptools, glob
class develop(easy_install):
"""Set up package for development"""
@@ -36,9 +36,6 @@ class develop(easy_install):
-
-
-
def finalize_options(self):
ei = self.get_finalized_command("egg_info")
if ei.broken_egg_info:
@@ -46,8 +43,14 @@ class develop(easy_install):
"Please rename %r to %r before using 'develop'"
% (ei.egg_info, ei.broken_egg_info)
)
- self.args = [ei.egg_name]
+ 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'))
@@ -62,7 +65,7 @@ class develop(easy_install):
"--egg-path must be a relative path from the install"
" directory to "+target
)
-
+
# Make a distribution for the package's source
self.dist = Distribution(
target,
@@ -81,11 +84,35 @@ class develop(easy_install):
" installation directory", p, normalize_path(os.curdir))
def install_for_development(self):
- # Ensure metadata is up-to-date
- self.run_command('egg_info')
- # Build extensions in-place
- self.reinitialize_command('build_ext', inplace=1)
- self.run_command('build_ext')
+ if sys.version_info >= (3,) and getattr(self.distribution, 'use_2to3', False):
+ # If we run 2to3 we can not do this inplace:
+
+ # Ensure metadata is up-to-date
+ self.reinitialize_command('build_py', inplace=0)
+ self.run_command('build_py')
+ bpy_cmd = self.get_finalized_command("build_py")
+ build_path = normalize_path(bpy_cmd.build_lib)
+
+ # Build extensions
+ self.reinitialize_command('egg_info', egg_base=build_path)
+ self.run_command('egg_info')
+
+ self.reinitialize_command('build_ext', inplace=0)
+ self.run_command('build_ext')
+
+ # Fixup egg-link and easy-install.pth
+ 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
+ else:
+ # Without 2to3 inplace works fine:
+ self.run_command('egg_info')
+
+ # Build extensions in-place
+ self.reinitialize_command('build_ext', inplace=1)
+ self.run_command('build_ext')
+
self.install_site_py() # ensure that target dir is site-safe
if setuptools.bootstrap_install_from:
self.easy_install(setuptools.bootstrap_install_from)
@@ -105,7 +132,9 @@ class develop(easy_install):
def uninstall_link(self):
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)]
+ 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]):
log.warn("Link points to %s: uninstall aborted", contents)
return
@@ -117,10 +146,6 @@ class develop(easy_install):
# XXX should also check for entry point scripts!
log.warn("Note: you must uninstall or replace scripts manually!")
-
-
-
-
def install_egg_scripts(self, dist):
if dist is not self.dist:
# Installing a dependency, so fall back to normal behavior
@@ -129,7 +154,7 @@ class develop(easy_install):
# create wrapper scripts in the script dir, pointing to dist.scripts
# new-style...
- self.install_wrapper_scripts(dist)
+ self.install_wrapper_scripts(dist)
# ...and old-style
for script_name in self.distribution.scripts or []:
@@ -140,25 +165,3 @@ class develop(easy_install):
f.close()
self.install_script(dist, script_name, script_text, script_path)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-