9 from subprocess import call
13 from distutils.core import setup
14 from DistUtilsExtra.command import (build_extra, build_i18n, build_help,
18 class PocketLint(distutils.cmd.Command):
19 """ command class that runs pocketlint """
22 def initialize_options(self):
25 def finalize_options(self):
28 def binary_in_path(self, binary):
29 return any([os.path.exists(os.path.join(p, binary))
30 for p in os.environ["PATH"].split(":")])
33 if not self.binary_in_path("pocketlint"):
34 sys.stderr.write("No pocketlint found in path\n"
35 "Use python-pocket-lint in natty or from "
39 for root, dirs, files in os.walk("."):
40 pyl = fnmatch.filter(files, "*.py")
41 py_files.extend([os.path.join(root, f) for f in pyl
42 if os.path.exists(os.path.join(root, f))])
43 call(["pocketlint"] + py_files)
46 def merge_authors_into_about_dialog():
47 fname = "./data/ui/gtk3/SoftwareCenter.ui"
48 authors = open("AUTHORS").read()
49 gtkbuilder = open(fname).read()
50 gtkbuilder = re.sub(r'<property name="authors">.*?</property>',
51 r'<property name="authors">%s</property>' % authors,
52 gtkbuilder, flags=re.DOTALL)
53 open(fname, "w").write(gtkbuilder)
56 def merge_extras_ubuntu_com_channel_file():
57 # update ubuntu-extras.list.in (this will not be part of debian as
58 # its killed of in debian/rules on a non-ubuntu build)
59 DISTROSERIES = platform.dist()[2]
60 channelfile = "data/channels/Ubuntu/ubuntu-extras.list"
61 s = open(channelfile + ".in").read()
62 open(channelfile, "w").write(s.replace("#DISTROSERIES#", DISTROSERIES))
66 line = open("version.txt").readline()
67 m = re.match("([\d\.]+) ([\w-]+)", line)
72 print "WARNING: Could not parse version number! Continuing with unknown release info!"
76 DISTRO = platform.dist()[0]
77 RELEASE = platform.dist()[1]
78 open("softwarecenter/version.py", "w").write("""
83 """ % (VERSION, CODENAME, DISTRO, RELEASE))
87 if sys.argv[1] == "build":
88 merge_authors_into_about_dialog()
89 merge_extras_ubuntu_com_channel_file()
90 call(["po4a", "po/help/po4a.conf"])
93 setup(name="software-center", version=VERSION,
94 scripts=["software-center",
96 "utils/submit_review_gtk3.py",
97 "utils/report_review_gtk3.py",
98 "utils/submit_usefulness_gtk3.py",
99 "utils/delete_review_gtk3.py",
100 "utils/modify_review_gtk3.py",
102 "utils/update-software-center",
103 "utils/update-software-center-channels",
104 "utils/update-software-center-agent",
106 "utils/expunge-cache.py",
107 ] + glob.glob("utils/piston-helpers/*.py"),
108 packages=['softwarecenter',
109 'softwarecenter.backend',
110 'softwarecenter.backend.installbackend_impl',
111 'softwarecenter.backend.channel_impl',
112 'softwarecenter.backend.oneconfhandler',
113 'softwarecenter.backend.piston',
114 'softwarecenter.backend.reviews',
116 'softwarecenter.db.pkginfo_impl',
117 'softwarecenter.db.history_impl',
118 'softwarecenter.distro',
120 'softwarecenter.ui.gtk3',
121 'softwarecenter.ui.gtk3.dialogs',
122 'softwarecenter.ui.gtk3.models',
123 'softwarecenter.ui.gtk3.panes',
124 'softwarecenter.ui.gtk3.session',
125 'softwarecenter.ui.gtk3.views',
126 'softwarecenter.ui.gtk3.widgets',
127 'softwarecenter.ui.qml',
131 ('share/software-center/ui/gtk3/',
132 glob.glob("data/ui/gtk3/*.ui")),
133 ('share/software-center/ui/gtk3/css/',
134 glob.glob("data/ui/gtk3/css/*.css")),
135 ('share/software-center/ui/gtk3/art/',
136 glob.glob("data/ui/gtk3/art/*.png")),
137 ('share/software-center/ui/gtk3/art/icons',
138 glob.glob("data/ui/gtk3/art/icons/*.png")),
139 ('share/software-center/default_banner',
140 glob.glob("data/default_banner/*")),
142 ('../etc/dbus-1/system.d/',
143 ["data/com.ubuntu.SoftwareCenter.conf"]),
145 ('share/software-center/images/',
146 glob.glob("data/images/*.png") +
147 glob.glob("data/images/*.gif")),
148 ('share/software-center/icons/',
149 glob.glob("data/emblems/*.png")),
151 ('share/apt-xapian-index/plugins',
152 glob.glob("apt-xapian-index-plugin/*.py")),
153 # extra software channels (can be distro specific)
154 ('/usr/share/app-install/channels/',
155 glob.glob("data/channels/%s/*" % DISTRO)),
157 cmdclass={"build": build_extra.build_extra,
158 "build_i18n": build_i18n.build_i18n,
159 "build_help": build_help.build_help,
160 "build_icons": build_icons.build_icons,