Merge lp:~mvo/software-center/use-pydebian-in-setup into lp:software-center

Proposed by Michael Vogt
Status: Merged
Approved by: dobey
Approved revision: 3283
Merged at revision: 3282
Proposed branch: lp:~mvo/software-center/use-pydebian-in-setup
Merge into: lp:software-center
Diff against target: 89 lines (+12/-36)
2 files modified
debian/control (+1/-0)
setup.py (+11/-36)
To merge this branch: bzr merge lp:~mvo/software-center/use-pydebian-in-setup
Reviewer Review Type Date Requested Status
dobey Approve
Review via email: mp+140609@code.launchpad.net

Commit message

Use python-debian to gather information from the changelog instead of regex.
Remove no longer used PocketLint.

Description of the change

This branch moves from using regexp for extracting the version number from the debian/changelog to python-debian to make it more robust. It also removes (as a drive-by cleanup) the Pocketlint command which we don't use anymore since we added the pyflakes test.

To post a comment you must log in.
Revision history for this message
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2012-12-11 10:58:08 +0000
3+++ debian/control 2012-12-19 10:07:29 +0000
4@@ -9,6 +9,7 @@
5 intltool,
6 po4a,
7 python,
8+ python-debian,
9 python-aptdaemon,
10 python-dbus,
11 python-distutils-extra,
12
13=== modified file 'setup.py'
14--- setup.py 2012-12-17 17:29:24 +0000
15+++ setup.py 2012-12-19 10:07:29 +0000
16@@ -12,34 +12,7 @@
17 from distutils.core import setup
18 from DistUtilsExtra.command import (build_extra, build_i18n, build_help,
19 build_icons)
20-
21-
22-class PocketLint(distutils.cmd.Command):
23- """ command class that runs pocketlint """
24- user_options = []
25-
26- def initialize_options(self):
27- pass
28-
29- def finalize_options(self):
30- pass
31-
32- def binary_in_path(self, binary):
33- return any([os.path.exists(os.path.join(p, binary))
34- for p in os.environ["PATH"].split(":")])
35-
36- def run(self):
37- if not self.binary_in_path("pocketlint"):
38- sys.stderr.write("No pocketlint found in path\n"
39- "Use python-pocket-lint in natty or from "
40- "ppa:sinzui\n")
41- return
42- py_files = []
43- for root, dirs, files in os.walk("."):
44- pyl = fnmatch.filter(files, "*.py")
45- py_files.extend([os.path.join(root, f) for f in pyl
46- if os.path.exists(os.path.join(root, f))])
47- call(["pocketlint"] + py_files)
48+from debian.changelog import Changelog
49
50
51 def merge_authors_into_about_dialog():
52@@ -62,13 +35,15 @@
53
54
55 # update version.py
56-line = open("debian/changelog").readline()
57-m = re.match("^[\w-]+ \(([\w\.~]+)\) ([\w-]+);", line)
58-VERSION = m.group(1)
59-CODENAME = m.group(2)
60-DISTRO = platform.dist()[0]
61-RELEASE = platform.dist()[1]
62-open("softwarecenter/version.py", "w").write("""
63+def update_version():
64+ changelog = Changelog(open("debian/changelog"), max_blocks=1)
65+ # use or upstream_version instead?
66+ VERSION = changelog.full_version
67+ CODENAME = changelog.distributions
68+ # this comes from the build host
69+ DISTRO = platform.dist()[0]
70+ RELEASE = platform.dist()[1]
71+ open("softwarecenter/version.py", "w").write("""
72 VERSION = '%s'
73 CODENAME = '%s'
74 DISTRO = '%s'
75@@ -78,6 +53,7 @@
76
77 # update po4a
78 if sys.argv[1] == "build":
79+ update_version()
80 merge_authors_into_about_dialog()
81 merge_extras_ubuntu_com_channel_file()
82 call(["po4a", "po/help/po4a.conf"])
83@@ -174,6 +150,5 @@
84 "build_i18n": build_i18n.build_i18n,
85 "build_help": build_help.build_help,
86 "build_icons": build_icons.build_icons,
87- "lint": PocketLint,
88 },
89 )

Subscribers

People subscribed via source and target branches