summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author?ric Araujo <merwok@netwok.org>2011-11-12 04:29:11 +0100
committer?ric Araujo <merwok@netwok.org>2011-11-12 04:29:11 +0100
commit118a6f15c7f87e80fec94b21385079d595614c22 (patch)
treea0c315432257c25ae61c2ad9062c3c8c6d8d03da
parentd9134f0145193e1a5d6a34739b3f82e078fe0ac6 (diff)
downloaddisutils2-118a6f15c7f87e80fec94b21385079d595614c22.tar.gz
Minor assorted cleanups.
- Remove __main__ blocks obsoleted by pysetup - Fix typo ?seperate? - Add one test that was promised but not written - Reorganize one file
-rw-r--r--distutils2/command/build.py2
-rw-r--r--distutils2/create.py4
-rw-r--r--distutils2/depgraph.py5
-rw-r--r--distutils2/dist.py2
-rw-r--r--distutils2/install.py9
-rw-r--r--distutils2/tests/test_command_bdist_dumb.py17
-rw-r--r--distutils2/tests/test_command_register.py1
-rw-r--r--distutils2/tests/test_command_sdist.py47
8 files changed, 39 insertions, 48 deletions
diff --git a/distutils2/command/build.py b/distutils2/command/build.py
index b2e5bf8..708b848 100644
--- a/distutils2/command/build.py
+++ b/distutils2/command/build.py
@@ -41,7 +41,7 @@ class build(Command):
('use-2to3', None,
"use 2to3 to make source python 3.x compatible"),
('convert-2to3-doctests', None,
- "use 2to3 to convert doctests in seperate text files"),
+ "use 2to3 to convert doctests in separate text files"),
('use-2to3-fixers', None,
"list additional fixers opted for during 2to3 conversion"),
]
diff --git a/distutils2/create.py b/distutils2/create.py
index 0696884..278e0a5 100644
--- a/distutils2/create.py
+++ b/distutils2/create.py
@@ -698,7 +698,3 @@ def main():
# program.write_setup_script()
# distutils2.util.cfg_to_args()
program()
-
-
-if __name__ == '__main__':
- main()
diff --git a/distutils2/depgraph.py b/distutils2/depgraph.py
index af8157c..30a2528 100644
--- a/distutils2/depgraph.py
+++ b/distutils2/depgraph.py
@@ -224,6 +224,7 @@ def dependent_dists(dists, dist):
def main():
+ # XXX move to run._graph
from distutils2.database import get_distributions
tempout = StringIO()
try:
@@ -270,7 +271,3 @@ def main():
else:
print 'Supported option: -d [filename]'
sys.exit(1)
-
-
-if __name__ == '__main__':
- main()
diff --git a/distutils2/dist.py b/distutils2/dist.py
index f879959..7d2b2ec 100644
--- a/distutils2/dist.py
+++ b/distutils2/dist.py
@@ -69,7 +69,7 @@ Common commands: (see '--help-commands' for more)
('use-2to3', None,
"use 2to3 to make source python 3.x compatible"),
('convert-2to3-doctests', None,
- "use 2to3 to convert doctests in seperate text files"),
+ "use 2to3 to convert doctests in separate text files"),
]
display_option_names = [x[0].replace('-', '_') for x in display_options]
diff --git a/distutils2/install.py b/distutils2/install.py
index 91cbd7a..84bd39f 100644
--- a/distutils2/install.py
+++ b/distutils2/install.py
@@ -531,12 +531,3 @@ def install(project):
logger.info('%r conflicts with %s', project, ','.join(projects))
return True
-
-
-def _main(**attrs):
- if 'script_args' not in attrs:
- attrs['requirements'] = sys.argv[1]
- get_infos(**attrs)
-
-if __name__ == '__main__':
- _main()
diff --git a/distutils2/tests/test_command_bdist_dumb.py b/distutils2/tests/test_command_bdist_dumb.py
index a31d14e..1097c54 100644
--- a/distutils2/tests/test_command_bdist_dumb.py
+++ b/distutils2/tests/test_command_bdist_dumb.py
@@ -1,6 +1,7 @@
"""Tests for distutils.command.bdist_dumb."""
import os
+import zipfile
import distutils2.util
from distutils2.dist import Distribution
@@ -49,15 +50,23 @@ class BuildDumbTestCase(support.TempdirManager,
# see what we have
dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
- base = "%s.%s" % (dist.get_fullname(), cmd.plat_name)
+ base = "%s.%s.zip" % (dist.get_fullname(), cmd.plat_name)
if os.name == 'os2':
base = base.replace(':', '-')
- wanted = ['%s.zip' % base]
- self.assertEqual(dist_created, wanted)
+ self.assertEqual(dist_created, [base])
# now let's check what we have in the zip file
- # XXX to be done
+ fp = zipfile.ZipFile(os.path.join('dist', base))
+ try:
+ contents = fp.namelist()
+ finally:
+ fp.close()
+
+ contents = sorted(os.path.basename(fn) for fn in contents)
+ wanted = ['foo.py', 'foo.pyc',
+ 'METADATA', 'INSTALLER', 'REQUESTED', 'RECORD']
+ self.assertEqual(contents, sorted(wanted))
def test_finalize_options(self):
pkg_dir, dist = self.create_dist()
diff --git a/distutils2/tests/test_command_register.py b/distutils2/tests/test_command_register.py
index a0326f9..a0a43e1 100644
--- a/distutils2/tests/test_command_register.py
+++ b/distutils2/tests/test_command_register.py
@@ -144,6 +144,7 @@ class RegisterTestCase(support.TempdirManager,
register_module.input = _no_way
cmd.show_response = True
+ cmd.finalized = False
cmd.ensure_finalized()
cmd.run()
diff --git a/distutils2/tests/test_command_sdist.py b/distutils2/tests/test_command_sdist.py
index f069c51..70832fe 100644
--- a/distutils2/tests/test_command_sdist.py
+++ b/distutils2/tests/test_command_sdist.py
@@ -2,8 +2,6 @@
import os
import zipfile
-from distutils2.tests.support import requires_zlib
-
try:
import grp
import pwd
@@ -12,17 +10,17 @@ except ImportError:
UID_GID_SUPPORT = False
from os.path import join
-from distutils2.tests import captured_stdout
-from distutils2.command.sdist import sdist
-from distutils2.command.sdist import show_formats
from distutils2.dist import Distribution
-from distutils2.tests import unittest
-from distutils2.errors import PackagingOptionError
from distutils2.util import find_executable
-from distutils2.tests import support
+from distutils2.errors import PackagingOptionError
+from distutils2.command.sdist import sdist, show_formats
from distutils2._backport import tarfile
from distutils2._backport.shutil import get_archive_formats
+from distutils2.tests import support, unittest
+from distutils2.tests import captured_stdout
+from distutils2.tests.support import requires_zlib
+
MANIFEST = """\
# file GENERATED by distutils2, do NOT edit
@@ -88,7 +86,6 @@ class SDistTestCase(support.TempdirManager,
# creating VCS directories with some files in them
os.mkdir(join(self.tmp_dir, 'somecode', '.svn'))
-
self.write_file((self.tmp_dir, 'somecode', '.svn', 'ok.py'), 'xxx')
os.mkdir(join(self.tmp_dir, 'somecode', '.hg'))
@@ -146,7 +143,7 @@ class SDistTestCase(support.TempdirManager,
# now trying a tar then a gztar
cmd.formats = ['tar', 'gztar']
-
+ cmd.finalized = False
cmd.ensure_finalized()
cmd.run()
@@ -274,6 +271,21 @@ class SDistTestCase(support.TempdirManager,
self.assertRaises(PackagingOptionError, cmd.finalize_options)
@requires_zlib
+ def test_template(self):
+ dist, cmd = self.get_cmd()
+ dist.extra_files = ['include yeah']
+ cmd.ensure_finalized()
+ self.write_file((self.tmp_dir, 'yeah'), 'xxx')
+ cmd.run()
+ f = open(cmd.manifest)
+ try:
+ content = f.read()
+ finally:
+ f.close()
+
+ self.assertIn('yeah', content)
+
+ @requires_zlib
@unittest.skipUnless(UID_GID_SUPPORT, "requires grp and pwd support")
@unittest.skipIf(find_executable('tar') is None or
find_executable('gzip') is None,
@@ -395,21 +407,6 @@ class SDistTestCase(support.TempdirManager,
self.assertEqual(manifest, ['README.manual'])
@requires_zlib
- def test_template(self):
- dist, cmd = self.get_cmd()
- dist.extra_files = ['include yeah']
- cmd.ensure_finalized()
- self.write_file((self.tmp_dir, 'yeah'), 'xxx')
- cmd.run()
- f = open(cmd.manifest)
- try:
- content = f.read()
- finally:
- f.close()
-
- self.assertIn('yeah', content)
-
- @requires_zlib
def test_manifest_builder(self):
dist, cmd = self.get_cmd()
cmd.manifest_builders = 'distutils2.tests.test_command_sdist.builder'