summaryrefslogtreecommitdiff
path: root/setuptools
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools')
-rw-r--r--setuptools/command/bdist_egg.py8
-rw-r--r--setuptools/tests/test_resources.py30
2 files changed, 19 insertions, 19 deletions
diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py
index d3139580..8692fd39 100644
--- a/setuptools/command/bdist_egg.py
+++ b/setuptools/command/bdist_egg.py
@@ -10,7 +10,7 @@ from distutils.dir_util import create_tree, remove_tree, ensure_relative,mkpath
from distutils.sysconfig import get_python_version, get_python_lib
from distutils.errors import *
from distutils import log
-from pkg_resources import parse_requirements, get_platform
+from pkg_resources import parse_requirements, get_platform, safe_name, safe_version
class bdist_egg(Command):
description = "create an \"egg\" distribution"
@@ -54,7 +54,7 @@ class bdist_egg(Command):
self.tag_date = 0
def finalize_options (self):
- self.egg_name = self.distribution.get_name().replace(' ','-')
+ self.egg_name = safe_name(self.distribution.get_name())
self.egg_version = self.tagged_version()
try:
list(
@@ -122,7 +122,6 @@ class bdist_egg(Command):
self.distribution.data_files = old
def run(self):
-
if not self.skip_build:
self.run_command('build')
@@ -161,6 +160,7 @@ class bdist_egg(Command):
self.egg_version.replace('-','_'), get_python_version())
if ext_outputs:
archive_basename += "-" + self.plat_name
+ ext_outputs = [out.replace(os.sep,'/') for out in ext_outputs]
# OS/2 objects to any ":" characters in a filename (such as when
# a timestamp is used in a version) so change them to underscores.
@@ -223,7 +223,7 @@ class bdist_egg(Command):
import time
version += time.strftime("-%Y%m%d")
- return version
+ return safe_version(version)
def get_svn_revision(self):
stdin, stdout = os.popen4("svn info"); stdin.close()
diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index f2a0d296..88b5f889 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -319,13 +319,20 @@ class ParseTests(TestCase):
)
self.assertRaises(ValueError,list,pkg_resources.split_sections("[foo"))
-
-
-
-
-
-
-
+ def testSafeName(self):
+ self.assertEqual(safe_name("adns-python"), "adns-python")
+ self.assertEqual(safe_name("WSGI Utils"), "WSGI-Utils")
+ self.assertEqual(safe_name("WSGI Utils"), "WSGI-Utils")
+ self.assertEqual(safe_name("Money$$$Maker"), "Money-Maker")
+ self.assertEqual(safe_name("peak.web"), "peak-web")
+
+ def testSafeVersion(self):
+ self.assertEqual(safe_version("1.2-1"), "1.2-1")
+ self.assertEqual(safe_version("1.2 alpha"), "1.2.alpha")
+ self.assertEqual(safe_version("2.3.4 20050521"), "2.3.4.20050521")
+ self.assertEqual(safe_version("Money$$$Maker"), "Money-Maker")
+ self.assertEqual(safe_version("peak.web"), "peak.web")
+
def testSimpleRequirements(self):
self.assertEqual(
list(parse_requirements('Twis-Ted>=1.2-1')),
@@ -358,14 +365,7 @@ class ParseTests(TestCase):
c('0pre1', '0.0c1')
c('0.0.0preview1', '0c1')
c('0.0c1', '0rc1')
-
-
-
-
-
-
-
-
+ c('1.2a1', '1.2.a.1'); c('1.2...a', '1.2a')
def testVersionOrdering(self):
def c(s1,s2):