diff --git a/debian/changelog b/debian/changelog index 5dd5e396cd52f0cb3aa88d23b46c11c63e2fc4e8..9d4e056ca762706f12eca7250f72a5edf3f7413c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -27,6 +27,8 @@ python-defaults (2.7.2-2) UNRELEASED; urgency=low - /usr/share/pyshared is not added to the package if empty (closes: 623909) - dh_python2's manpage updated (among other changes, no longer advertises python:Breaks - closes: 631397, describes .pyinstall and .pyremove files) + - remove setuptools from requires.txt (it is replaced with + python-pkg-resources Debian dependency) -- Piotr Ożarowski <piotr@debian.org> Sun, 12 Jun 2011 13:28:48 +0200 diff --git a/debpython/pydist.py b/debpython/pydist.py index 9bf928358a1a1c54b14fc25af8b746e8324675fa..fdfb18319653ce94b1aa17591f09db89d6547527 100644 --- a/debpython/pydist.py +++ b/debpython/pydist.py @@ -186,16 +186,33 @@ def parse_pydep(fname): ver = None result = [] + modified = optional_section = False + processed = [] with open(fname, 'r') as fp: - for line in fp: - line = line.strip() - # ignore all optional sections + lines = [i.strip() for i in fp.readlines()] + for line in lines: + if not line or line.startswith('#'): + processed.append(line) + continue if line.startswith('['): - break - if line: - dependency = guess_dependency(line, ver) - if dependency: - result.append(dependency) + optional_section = True + if optional_section: + processed.append(line) + continue + dependency = guess_dependency(line, ver) + if dependency: + result.append(dependency) + if 'setuptools' in line.lower(): + # TODO: or dependency in recommends\ + # or dependency in suggests + modified = True + else: + processed.append(line) + else: + processed.append(line) + if modified: + with open(fname, 'w') as fp: + fp.writelines(i + '\n' for i in processed) return result