diff options
author | Anthony Baxter <anthonybaxter@gmail.com> | 2004-03-22 22:22:05 (GMT) |
---|---|---|
committer | Anthony Baxter <anthonybaxter@gmail.com> | 2004-03-22 22:22:05 (GMT) |
commit | 05f842bae280914ce37a7ce2774bcc25cfaf4814 (patch) | |
tree | 2961957d5b80ab197c7b15268d73f1ff7300cfd7 /Lib/distutils/command/install.py | |
parent | a3837a0d6394f9299e9cf5b4c67fcc705ec548ed (diff) | |
download | cpython-05f842bae280914ce37a7ce2774bcc25cfaf4814.zip cpython-05f842bae280914ce37a7ce2774bcc25cfaf4814.tar.gz cpython-05f842bae280914ce37a7ce2774bcc25cfaf4814.tar.bz2 |
Basic dependency checking. setup() has two new optional arguments
requires and provides. requires is a sequence of strings, of the
form 'packagename-version'. The dependency checking so far merely
does an '__import__(packagename)' and checks for packagename.__version__
You can also leave off the version, and any version of the package
will be installed.
There's a special case for the package 'python' - sys.version_info
is used, so
requires= ( 'python-2.3', )
just works.
Provides is of the same format as requires - but if it's not supplied,
a provides is generated by adding the version to each entry in packages,
or modules if packages isn't there.
Provides is currently only used in the PKG-INFO file. Shortly, PyPI
will grow the ability to accept these lines, and register will be
updated to send them.
There's a new command 'checkdep' command that runs these checks.
For this version, only greater-than-or-equal checking is done. We'll
add the ability to specify an optional operator later.
Diffstat (limited to 'Lib/distutils/command/install.py')
-rw-r--r-- | Lib/distutils/command/install.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py index 5d5bdaa..7fb46a7 100644 --- a/Lib/distutils/command/install.py +++ b/Lib/distutils/command/install.py @@ -126,6 +126,8 @@ class install (Command): "force installation (overwrite any existing files)"), ('skip-build', None, "skip rebuilding everything (for testing/debugging)"), + ('skip-checkdep', None, + "skip checking dependencies (use at own risk)"), # Where to install documentation (eventually!) #('doc-format=', None, "format of documentation to generate"), @@ -183,12 +185,15 @@ class install (Command): # 'force' forces installation, even if target files are not # out-of-date. 'skip_build' skips running the "build" command, - # handy if you know it's not necessary. 'warn_dir' (which is *not* + # handy if you know it's not necessary. 'skip_checkdep' skips + # the 'checkdep' command, if you are sure you can work around the + # dependency failure in another way. 'warn_dir' (which is *not* # a user option, it's just there so the bdist_* commands can turn # it off) determines whether we warn about installing to a # directory not in sys.path. self.force = 0 self.skip_build = 0 + self.skip_checkdep = 0 self.warn_dir = 1 # These are only here as a conduit from the 'build' command to the @@ -500,6 +505,12 @@ class install (Command): if not self.skip_build: self.run_command('build') + # We check dependencies before we install + # For now, this is disabled. Before 2.4 is released, this will + # be turned on. + #if not self.skip_checkdep: + # self.run_command('checkdep') + # Run all sub-commands (at least those that need to be run) for cmd_name in self.get_sub_commands(): self.run_command(cmd_name) |