[Python-checkins] distutils2: Branch merge
tarek.ziade
python-checkins at python.org
Sat Nov 6 22:56:15 CET 2010
tarek.ziade pushed ecb57a40e3e6 to distutils2:
http://hg.python.org/distutils2/rev/ecb57a40e3e6
changeset: 799:ecb57a40e3e6
parent: 798:1e41afca6ae3
parent: 797:d05294025916
user: ?ric Araujo <merwok at netwok.org>
date: Sat Nov 06 05:34:26 2010 +0100
summary: Branch merge
files: distutils2/__init__.py, distutils2/dist.py, distutils2/tests/test_dist.py, distutils2/util.py
diff --git a/distutils2/_backport/sysconfig.py b/distutils2/_backport/sysconfig.py
--- a/distutils2/_backport/sysconfig.py
+++ b/distutils2/_backport/sysconfig.py
@@ -266,7 +266,7 @@
return vars
-def _get_makefile_filename():
+def get_makefile_filename():
if _PYTHON_BUILD:
return os.path.join(_PROJECT_BASE, "Makefile")
return os.path.join(get_path('stdlib'), "config", "Makefile")
@@ -275,7 +275,7 @@
def _init_posix(vars):
"""Initialize the module as appropriate for POSIX systems."""
# load the installed Makefile:
- makefile = _get_makefile_filename()
+ makefile = get_makefile_filename()
try:
_parse_makefile(makefile, vars)
except IOError, e:
diff --git a/distutils2/_backport/tests/test_sysconfig.py b/distutils2/_backport/tests/test_sysconfig.py
--- a/distutils2/_backport/tests/test_sysconfig.py
+++ b/distutils2/_backport/tests/test_sysconfig.py
@@ -230,6 +230,10 @@
config_h = sysconfig.get_config_h_filename()
self.assertTrue(os.path.isfile(config_h), config_h)
+ def test_get_makefile_filename(self):
+ makefile = sysconfig.get_makefile_filename()
+ self.assertTrue(os.path.isfile(makefile), makefile)
+
def test_get_scheme_names(self):
wanted = ('nt', 'nt_user', 'os2', 'os2_home', 'osx_framework_user',
'posix_home', 'posix_prefix', 'posix_user')
diff --git a/distutils2/command/command_template b/distutils2/command/command_template
--- a/distutils2/command/command_template
+++ b/distutils2/command/command_template
@@ -1,45 +1,36 @@
-"""distutils.command.x
+"""Implementation of the 'x' command."""
-Implements the Distutils 'x' command.
-"""
+import logging
+from distutils2.command.cmd import Command
-# created 2000/mm/dd, John Doe
-__revision__ = "$Id$"
-
-from distutils.core import Command
-
-
-class x (Command):
+class x(Command):
# Brief (40-50 characters) description of the command
description = ""
# List of option tuples: long name, short name (None if no short
# name), and help string.
- user_options = [('', '',
- ""),
- ]
+ user_options = [
+ ('', '', # long option, short option (one letter) or None
+ ""), # help text
+ ]
- def initialize_options (self):
+ def initialize_options(self):
self. = None
self. = None
self. = None
- # initialize_options()
+ def finalize_options(self):
+ if self.x is None:
+ self.x = ...
+ def run(self):
+ ...
+ logging.info(...)
- def finalize_options (self):
- if self.x is None:
- self.x =
+ if not self.dry_run:
+ ...
- # finalize_options()
-
-
- def run (self):
-
-
- # run()
-
-# class x
+ self.execute(..., dry_run=self.dry_run)
diff --git a/distutils2/dist.py b/distutils2/dist.py
--- a/distutils2/dist.py
+++ b/distutils2/dist.py
@@ -415,9 +415,6 @@
list if there are no more commands on the command line. Returns
None if the user asked for help on this command.
"""
- # late import because of mutual dependence between these modules
- from distutils2.command.cmd import Command
-
# Pull the current command from the head of the command line
command = args[0]
if not command_re.match(command):
@@ -668,7 +665,7 @@
description = cls.description
except AttributeError:
description = "(no description available)"
- rv.append((cmd, description))
+ rv.append((cls, description))
return rv
# -- Command class/object methods ----------------------------------
diff --git a/distutils2/install.py b/distutils2/install.py
--- a/distutils2/install.py
+++ b/distutils2/install.py
@@ -63,13 +63,14 @@
# Get all the releases that match the requirements
try:
releases = index.get_releases(requirements)
- except (ReleaseNotFound, ProjectNotFound), e:
+ except (ReleaseNotFound, ProjectNotFound):
raise InstallationException('Release not found: "%s"' % requirements)
# Pick up a release, and try to get the dependency tree
release = releases.get_last(requirements, prefer_final=prefer_final)
# Iter since we found something without conflicts
+ # XXX the metadata object is not used, remove the call or the binding
metadata = release.fetch_metadata()
# Get the distributions already_installed on the system
diff --git a/distutils2/tests/test_dist.py b/distutils2/tests/test_dist.py
--- a/distutils2/tests/test_dist.py
+++ b/distutils2/tests/test_dist.py
@@ -194,7 +194,7 @@
cmds = dist.get_command_packages()
self.assertEqual(cmds, ['distutils2.command'])
self.assertEqual(dist.command_packages,
- ['distutils2.command'])
+ ['distutils2.command'])
dist.command_packages = 'one,two'
cmds = dist.get_command_packages()
@@ -231,7 +231,7 @@
all_files = d.find_config_files()
d = distutils2.dist.Distribution(attrs={'script_args':
- ['--no-user-cfg']})
+ ['--no-user-cfg']})
files = d.find_config_files()
finally:
os.path.expanduser = old_expander
@@ -444,24 +444,20 @@
finally:
f.close()
- try:
- dist = Distribution()
+ dist = Distribution()
- # linux-style
- if sys.platform in ('linux', 'darwin'):
- os.environ['HOME'] = temp_dir
- files = dist.find_config_files()
- self.assertTrue(user_filename in files)
+ # linux-style
+ if sys.platform in ('linux', 'darwin'):
+ os.environ['HOME'] = temp_dir
+ files = dist.find_config_files()
+ self.assertTrue(user_filename in files)
- # win32-style
- if sys.platform == 'win32':
- # home drive should be found
- os.environ['HOME'] = temp_dir
- files = dist.find_config_files()
- self.assertTrue(user_filename in files,
- '%r not found in %r' % (user_filename, files))
- finally:
- os.remove(user_filename)
+ # win32-style
+ if sys.platform == 'win32':
+ # home drive should be found
+ os.environ['HOME'] = temp_dir
+ files = dist.find_config_files()
+ self.assertIn(user_filename, files)
def test_fix_help_options(self):
help_tuples = [('a', 'b', 'c', 'd'), (1, 2, 3, 4)]
diff --git a/distutils2/util.py b/distutils2/util.py
--- a/distutils2/util.py
+++ b/distutils2/util.py
@@ -643,7 +643,7 @@
"""
parts = name.split('.')
cursor = len(parts)
- module_name, rest = parts[:cursor], parts[cursor:]
+ module_name = parts[:cursor]
while cursor > 0:
try:
@@ -654,7 +654,6 @@
raise
cursor -= 1
module_name = parts[:cursor]
- rest = parts[cursor:]
ret = ''
for part in parts[1:]:
@@ -735,7 +734,7 @@
else:
try:
fp = tar.extractfile(member)
- except (KeyError, AttributeError), e:
+ except (KeyError, AttributeError):
# Some corrupt tar files seem to produce this
# (specifically bad symlinks)
continue
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python
# -*- encoding: utf8 -*-
-__revision__ = "$Id$"
import sys
import os
import re
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list