Fix some DeprecationWarnings and ResourceWarnings.

--HG--
branch : distribute
extra : rebase_source : 1293f856181d35c735670b021e8745208103f640
parent cbcd321e
......@@ -7,6 +7,7 @@ CHANGES
------
* Fix test suite with Python 2.6.
* Fix some DeprecationWarnings and ResourceWarnings.
------
0.6.31
......
......@@ -15,8 +15,10 @@ if sys.version_info >= (3,):
from distutils import dir_util, file_util, util, log
log.set_verbosity(1)
fl = FileList()
for line in open("MANIFEST.in"):
manifest_file = open("MANIFEST.in")
for line in manifest_file:
fl.process_template_line(line)
manifest_file.close()
dir_util.create_tree(tmp_src, fl.files)
outfiles_2to3 = []
dist_script = os.path.join("build", "src", "distribute_setup.py")
......@@ -39,7 +41,9 @@ from distutils.util import convert_path
d = {}
init_path = convert_path('setuptools/command/__init__.py')
exec(open(init_path).read(), d)
init_file = open(init_path)
exec(init_file.read(), d)
init_file.close()
SETUP_COMMANDS = d['__all__']
VERSION = "0.6.32"
......@@ -132,21 +136,27 @@ if _being_installed():
_before_install()
# return contents of reStructureText file with linked issue references
def _linkified(rstfile):
def _linkified(rst_path):
bitroot = 'http://bitbucket.org/tarek/distribute'
revision = re.compile(r'\b(issue\s*#?\d+)\b', re.M | re.I)
rstext = open(rstfile).read()
rst_file = open(rst_path)
rst_content = rst_file.read()
rst_file.close()
anchors = revision.findall(rstext) # ['Issue #43', ...]
anchors = revision.findall(rst_content) # ['Issue #43', ...]
anchors = sorted(set(anchors))
rstext = revision.sub(r'`\1`_', rstext)
rstext += "\n"
rst_content = revision.sub(r'`\1`_', rst_content)
rst_content += "\n"
for x in anchors:
issue = re.findall(r'\d+', x)[0]
rstext += '.. _`%s`: %s/issue/%s\n' % (x, bitroot, issue)
rstext += "\n"
return rstext
rst_content += '.. _`%s`: %s/issue/%s\n' % (x, bitroot, issue)
rst_content += "\n"
return rst_content
readme_file = open('README.txt')
long_description = readme_file.read() + _linkified('CHANGES.txt')
readme_file.close()
dist = setup(
name="distribute",
......@@ -156,7 +166,7 @@ dist = setup(
author="The fellowship of the packaging",
author_email="distutils-sig@python.org",
license="PSF or ZPL",
long_description = open('README.txt').read() + _linkified('CHANGES.txt'),
long_description = long_description,
keywords = "CPAN PyPI distutils eggs package management",
url = "http://packages.python.org/distribute",
test_suite = 'setuptools.tests',
......
......@@ -236,7 +236,7 @@ class TestUserInstallTest(unittest.TestCase):
f = open(egg_file, 'w')
try:
f.write('Name: foo\n')
except:
finally:
f.close()
sys.path.append(target)
......@@ -387,7 +387,7 @@ class TestSetupRequires(unittest.TestCase):
lines = stdout.splitlines()
self.assertTrue(len(lines) > 0)
self.assert_(lines[-1].strip(), 'test_pkg')
self.assertTrue(lines[-1].strip(), 'test_pkg')
try:
tempdir_context(setup_and_run)
......
......@@ -16,15 +16,15 @@ class TestMarkerlib(unittest.TestCase):
os_name = os.name
self.assert_(interpret(""))
self.assertTrue(interpret(""))
self.assert_(interpret("os.name != 'buuuu'"))
self.assert_(interpret("python_version > '1.0'"))
self.assert_(interpret("python_version < '5.0'"))
self.assert_(interpret("python_version <= '5.0'"))
self.assert_(interpret("python_version >= '1.0'"))
self.assert_(interpret("'%s' in os.name" % os_name))
self.assert_(interpret("'buuuu' not in os.name"))
self.assertTrue(interpret("os.name != 'buuuu'"))
self.assertTrue(interpret("python_version > '1.0'"))
self.assertTrue(interpret("python_version < '5.0'"))
self.assertTrue(interpret("python_version <= '5.0'"))
self.assertTrue(interpret("python_version >= '1.0'"))
self.assertTrue(interpret("'%s' in os.name" % os_name))
self.assertTrue(interpret("'buuuu' not in os.name"))
self.assertFalse(interpret("os.name == 'buuuu'"))
self.assertFalse(interpret("python_version < '1.0'"))
......@@ -36,7 +36,7 @@ class TestMarkerlib(unittest.TestCase):
environment = default_environment()
environment['extra'] = 'test'
self.assert_(interpret("extra == 'test'", environment))
self.assertTrue(interpret("extra == 'test'", environment))
self.assertFalse(interpret("extra == 'doc'", environment))
def raises_nameError():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment