From 1b6e103a6ef64454e55442a2e5327ac64bdb1ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20O=C5=BCarowski?= <piotr@debian.org> Date: Thu, 30 Jun 2011 23:39:15 +0200 Subject: [PATCH] remove setuptools from requires.txt (it is replaced with python-pkg-resources Debian dependency) --- debian/changelog | 2 ++ debpython/pydist.py | 33 +++++++++++++++++++++++++-------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index 5dd5e39..9d4e056 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 9bf9283..fdfb183 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 -- GitLab