summaryrefslogtreecommitdiff
path: root/paste
diff options
context:
space:
mode:
authorianb <devnull@localhost>2005-07-13 03:54:29 +0000
committerianb <devnull@localhost>2005-07-13 03:54:29 +0000
commit0ebeb3144c516cf1766d9a7843ce07aebd51cafb (patch)
treee379b32baf3a37df0bcb6658e306aff22d08da5d /paste
parent8d0c22867b505ab42d5113a16e9c973c606d3a03 (diff)
downloadpaste-0ebeb3144c516cf1766d9a7843ce07aebd51cafb.tar.gz
Remove install-related commands (that will all just go in the setuptools command lines)
Diffstat (limited to 'paste')
-rw-r--r--paste/app_setup.py106
-rw-r--r--paste/pyconfig.py30
2 files changed, 1 insertions, 135 deletions
diff --git a/paste/app_setup.py b/paste/app_setup.py
index fddc756..21b1eee 100644
--- a/paste/app_setup.py
+++ b/paste/app_setup.py
@@ -134,7 +134,7 @@ class CommandRunner(object):
self.register(CommandHelp)
self.register(CommandList)
self.register(CommandServe)
- self.register(CommandInstall)
+ #self.register(CommandInstall)
############################################################
## Command framework
@@ -523,110 +523,6 @@ class CommandHelp(Command):
print '%s (Aliases: %s)' % (
' '*max_len, ', '.join(command.aliases))
-class CommandInstall(Command):
-
- name = 'install'
- summary = 'Install software and enable plugins'
-
- parser = standard_parser(simulate=False, interactive=False)
- parser.add_option(
- '--enable',
- help="Enable the Paste plugin in the given package (don't install)",
- action="store_true",
- dest="enable")
- parser.add_option(
- '-d', '--install-dir',
- metavar="DIR",
- help="Directory to install into (default: site-packages)",
- dest="install_dir")
- parser.add_option(
- '-s', '--site-packages',
- help="Install in site-packages (install globally)",
- action="store_true",
- dest="site_packages")
-
- max_args = 1
- min_args = 1
-
- def command(self):
- global easy_install
- import easy_install
- self.conf = pyconfig.Config(with_default=True)
- self.server_conf_fn = self.runner.server_conf_fn
- if self.server_conf_fn:
- self.conf.load(self.server_conf_fn)
- spec = self.args[0]
- if not self.options.enable:
- packages = self.distribution_packages(self.install(spec))
- else:
- if self.options.install_dir:
- raise InvalidCommand(
- "You cannot provide the --install-dir option with --enable")
- packages = [spec]
- for pkg in packages:
- self.enable(pkg)
-
- def install(self, spec):
- v = self.options.verbose
- instdir = self.options.install_dir
- if instdir is None:
- instdir = self.conf.get('app_packages', 'app-packages')
- instdir = os.path.join(os.path.dirname(self.server_conf_fn),
- instdir)
- if self.options.site_packages:
- inst_dir = None
- if instdir and instdir not in sys.path:
- sys.path.install(0, instdir)
- if instdir and not os.path.exists(instdir):
- os.makedirs(instdir)
- urlspec = easy_install.URL_SCHEME(spec)
- if not urlspec:
- spec = self.conf['package_urls'].get(spec, spec)
- installer = easy_install.Installer(instdir)
- try:
- if v:
- print 'Acquiring', spec
- downloaded = installer.download(spec)
- installed = installer.install_eggs(downloaded)
- for dist in installed:
- dist.install_on()
- finally:
- installer.close()
- if v:
- print 'Installed into', (
- ', '.join([i.path for i in installed]))
- return installed
-
- def enable(self, package):
- v = self.options.verbose
- pkg_mod = import_string.import_module(package)
- pkg_dir = os.path.dirname(pkg_mod.__file__)
- installer_fn = os.path.join(pkg_dir, 'paste_install.py')
- if not os.path.exists(installer_fn):
- if self.options.enable:
- raise InvalidCommand(
- "The package %s cannot be enabled (the modules "
- "%s doesn't exist)" % (package, installer_fn))
- if v:
- print '%s does not exist; not enabling %s' % (
- installer_fn, package)
- return
- installer_mod = import_string.import_module(
- package + '.paste_install')
- installer_mod.install_in_paste(
- os.path.dirname(server.__file__))
- if v:
- print '%s enabled' % package
-
- def distribution_packages(self, dists):
- pkgs = []
- for dist in dists:
- for fn in os.listdir(dist.path):
- if os.path.exists(
- os.path.join(dist.path, fn, '__init__.py')):
- pkgs.append(fn)
- return pkgs
-
############################################################
## Optional helper commands
############################################################
diff --git a/paste/pyconfig.py b/paste/pyconfig.py
index 4356812..e0896d9 100644
--- a/paste/pyconfig.py
+++ b/paste/pyconfig.py
@@ -425,33 +425,3 @@ def make_list(option):
return option
return [s.strip() for s in option.split(',')]
-def make_use_package(conf, relative_to, namespace):
- def use_package(package_spec, url=None, instdir=None, zip_ok=False,
- multi=None, tmpdir=None):
- import easy_install
- from pkg_resources import DistributionNotFound, require
- if instdir is None:
- instdir = namespace.get('app_packages', 'app-packages')
- instdir = os.path.join(os.path.dirname(relative_to), instdir)
- if instdir not in sys.path:
- sys.path.insert(0, instdir)
- if not os.path.exists(instdir):
- os.makedirs(instdir)
- try:
- require(package_spec)
- except DistributionNotFound, e:
- pass
- else:
- return
- if url is None:
- url = namespace['package_urls'][package_spec]
- installer = easy_install.Installer(instdir, zip_ok, multi, tmpdir)
- try:
- downloaded = installer.download(url)
- installer.install_eggs(downloaded)
- finally:
- installer.close()
- require(package_spec)
- return use_package
-
-Config.builtins['use_package'] = make_use_package