~gary-lasker/software-center/pyflakes-fixes

43 by Michael Vogt
add setup.{py,cfg} and i18n
1
#!/usr/bin/env python
2
1301 by Michael Vogt
* setup.py:
3
import distutils
4
import fnmatch
43 by Michael Vogt
add setup.{py,cfg} and i18n
5
import glob
6
import os
1301 by Michael Vogt
* setup.py:
7
import re
574 by Michael Vogt
* po/help/po4a.conf:
8
from subprocess import Popen, PIPE, call
284 by Michael Vogt
* setup.py:
9
import sys
10
1301 by Michael Vogt
* setup.py:
11
from distutils.core import setup
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
12
from DistUtilsExtra.command import (build_extra, build_i18n, build_help,
13
                                    build_icons)
14
1301 by Michael Vogt
* setup.py:
15
16
class PocketLint(distutils.cmd.Command):
17
    """ command class that runs pocketlint """
18
    user_options = []
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
19
1301 by Michael Vogt
* setup.py:
20
    def initialize_options(self):
21
        pass
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
22
1301 by Michael Vogt
* setup.py:
23
    def finalize_options(self):
24
        pass
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
25
1301 by Michael Vogt
* setup.py:
26
    def binary_in_path(self, binary):
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
27
        return any([os.path.exists(os.path.join(p, binary))
1301 by Michael Vogt
* setup.py:
28
                    for p in os.environ["PATH"].split(":")])
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
29
1301 by Michael Vogt
* setup.py:
30
    def run(self):
31
        if not self.binary_in_path("pocketlint"):
32
            sys.stderr.write("No pocketlint found in path\n"
33
                             "Use python-pocket-lint in natty or from "
34
                             "ppa:sinzui\n")
35
            return
36
        py_files = []
37
        for root, dirs, files in os.walk("."):
38
            pyl = fnmatch.filter(files, "*.py")
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
39
            py_files.extend([os.path.join(root, f) for f in pyl
40
                             if os.path.exists(os.path.join(root, f))])
2077 by Michael Vogt
some pep8 fixes, but probably not worth the trouble going through all of them
41
        call(["pocketlint"] + py_files)
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
42
43
1395 by Michael Vogt
include full AUTHORS info into the about dialog,
44
def merge_authors_into_about_dialog():
2109 by Michael Vogt
* setup.py:
45
    for fname in ["./data/ui/gtk/SoftwareCenter.ui", 
46
                  "./data/ui/gtk3/SoftwareCenter.ui"]:
47
        authors = open("AUTHORS").read()
48
        gtkbuilder = open(fname).read()
49
        gtkbuilder = re.sub(r'<property name="authors">.*?</property>',
50
                            r'<property name="authors">%s</property>' % authors,
51
                            gtkbuilder, flags=re.DOTALL)
52
        open(fname, "w").write(gtkbuilder)
1395 by Michael Vogt
include full AUTHORS info into the about dialog,
53
54
284 by Michael Vogt
* setup.py:
55
# update version.py
56
line = open("debian/changelog").readline()
502 by Michael Vogt
setup.py: deal with codenames like karmic-proposed
57
m = re.match("^[\w-]+ \(([\w\.~]+)\) ([\w-]+);", line)
284 by Michael Vogt
* setup.py:
58
VERSION = m.group(1)
59
CODENAME = m.group(2)
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
60
DISTRO = Popen(
61
    ["lsb_release", "-s", "-i"], stdout=PIPE).communicate()[0].strip()
62
RELEASE = Popen(
63
    ["lsb_release", "-s", "-r"], stdout=PIPE).communicate()[0].strip()
64
open("softwarecenter/version.py", "w").write("""
284 by Michael Vogt
* setup.py:
65
VERSION='%s'
66
CODENAME='%s'
67
DISTRO='%s'
68
RELEASE='%s'
69
""" % (VERSION, CODENAME, DISTRO, RELEASE))
70
574 by Michael Vogt
* po/help/po4a.conf:
71
# update po4a
72
if sys.argv[1] == "build":
1395 by Michael Vogt
include full AUTHORS info into the about dialog,
73
    merge_authors_into_about_dialog()
574 by Michael Vogt
* po/help/po4a.conf:
74
    call(["po4a", "po/help/po4a.conf"])
284 by Michael Vogt
* setup.py:
75
574 by Michael Vogt
* po/help/po4a.conf:
76
# real setup
330 by Michael Vogt
renamed to "Ubuntu Software Center" and software-center (LP: #436648)
77
setup(name="software-center", version=VERSION,
78
      scripts=["software-center",
2020 by Michael Vogt
install gtk3 version as software-center-gtk3 tech preview
79
               "software-center-gtk3",
2040 by Michael Vogt
* setup.py:
80
               # gtk
495.2.32 by Michael Vogt
move submit_review.py to utils and install in /usr/share/software-center/utils
81
               "utils/submit_review.py",
495.2.52 by Michael Vogt
make report abuse work, refresh app details when new reviews are added or abuse reported
82
               "utils/report_review.py",
1535.1.10 by Kiwinote
* setup.py:
83
               "utils/submit_usefulness.py",
1439.2.41 by Aaron Peachey
* setup.py: include delete_review.py and modify_review.py
84
               "utils/delete_review.py",
85
               "utils/modify_review.py",
2040 by Michael Vogt
* setup.py:
86
               # gtk3
87
               "utils/submit_review_gtk3.py",
88
               "utils/report_review_gtk3.py",
89
               "utils/submit_usefulness_gtk3.py",
90
               "utils/delete_review_gtk3.py",
91
               "utils/modify_review_gtk3.py",
92
               # db helpers
330 by Michael Vogt
renamed to "Ubuntu Software Center" and software-center (LP: #436648)
93
               "utils/update-software-center",
858.2.47 by Michael Vogt
utils/update-software-center-agent: fix imports; setup.py: add u-s-c-agent script
94
               "utils/update-software-center-agent",
2077 by Michael Vogt
some pep8 fixes, but probably not worth the trouble going through all of them
95
               ] + glob.glob("utils/piston-helpers/*.py"),
96
      packages=['softwarecenter',
97
                'softwarecenter.backend',
1809.1.51 by Alex Eftimie
fixed python setup.py build failing from not finding aptd.py
98
                'softwarecenter.backend.installbackend_impl',
2077 by Michael Vogt
some pep8 fixes, but probably not worth the trouble going through all of them
99
                'softwarecenter.backend.piston',
100
                'softwarecenter.db',
101
                'softwarecenter.db.pkginfo_impl',
102
                'softwarecenter.db.history_impl',
103
                'softwarecenter.distro',
104
                'softwarecenter.ui',
105
                'softwarecenter.ui.gtk',
106
                'softwarecenter.ui.gtk.models',
107
                'softwarecenter.ui.gtk.widgets',
108
                'softwarecenter.ui.gtk3',
109
                'softwarecenter.ui.gtk3.dialogs',
110
                'softwarecenter.ui.gtk3.models',
111
                'softwarecenter.ui.gtk3.panes',
112
                'softwarecenter.ui.gtk3.session',
113
                'softwarecenter.ui.gtk3.views',
114
                'softwarecenter.ui.gtk3.widgets',
115
                'softwarecenter.ui.qml',
116
                ],
43 by Michael Vogt
add setup.{py,cfg} and i18n
117
      data_files=[
2020 by Michael Vogt
install gtk3 version as software-center-gtk3 tech preview
118
                  # gtk2
1912 by Michael Vogt
* data/ui/*.ui:
119
                  ('share/software-center/ui/gtk/',
120
                   glob.glob("data/ui/gtk/*.ui")),
2020 by Michael Vogt
install gtk3 version as software-center-gtk3 tech preview
121
                  # gtk3
122
                  ('share/software-center/ui/gtk3/',
123
                   glob.glob("data/ui/gtk3/*.ui")),
124
                  ('share/software-center/ui/gtk3/css/',
125
                   glob.glob("data/ui/gtk3/css/*.css")),
126
                  ('share/software-center/ui/gtk3/art/',
127
                   glob.glob("data/ui/gtk3/art/*.png")),
128
                  ('share/software-center/ui/gtk3/art/icons',
129
                   glob.glob("data/ui/gtk3/art/icons/*.png")),
2051 by Michael Vogt
setup.py: install the offline banners too
130
                  ('share/software-center/default_banner',
131
                   glob.glob("data/default_banner/*")),
2020 by Michael Vogt
install gtk3 version as software-center-gtk3 tech preview
132
                  # html
330 by Michael Vogt
renamed to "Ubuntu Software Center" and software-center (LP: #436648)
133
                  ('share/software-center/templates/',
87.1.21 by Michael Vogt
setup.py: install templates too
134
                   glob.glob("data/templates/*.html")),
2020 by Michael Vogt
install gtk3 version as software-center-gtk3 tech preview
135
                  # dbus
286 by Michael Vogt
implement dbus service that informs the GUI if the database
136
                  ('../etc/dbus-1/system.d/',
330 by Michael Vogt
renamed to "Ubuntu Software Center" and software-center (LP: #436648)
137
                   ["data/com.ubuntu.SoftwareCenter.conf"]),
2020 by Michael Vogt
install gtk3 version as software-center-gtk3 tech preview
138
                  # images
359.1.1 by Michael Vogt
* softwarecenter/view/appdetailsview.py:
139
                  ('share/software-center/images/',
2077 by Michael Vogt
some pep8 fixes, but probably not worth the trouble going through all of them
140
                   glob.glob("data/images/*.png") +
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
141
                   glob.glob("data/images/*.gif")),
403 by Michael Vogt
install the softwarecenter-installed emblem into a private dir
142
                  ('share/software-center/icons/',
143
                   glob.glob("data/emblems/*.png")),
2020 by Michael Vogt
install gtk3 version as software-center-gtk3 tech preview
144
                  # xpian
560 by Michael Vogt
* apt-xapian-index-plugin/software-center.py:
145
                  ('share/apt-xapian-index/plugins',
146
                   glob.glob("apt-xapian-index-plugin/*.py")),
2020 by Michael Vogt
install gtk3 version as software-center-gtk3 tech preview
147
                  # apport
1839 by Michael Vogt
add in an apport package hook for software-center that adds
148
                  ('share/apport/package-hooks/',
149
                   ['debian/source_software-center.py']),
43 by Michael Vogt
add setup.{py,cfg} and i18n
150
                  ],
2077 by Michael Vogt
some pep8 fixes, but probably not worth the trouble going through all of them
151
      cmdclass={"build": build_extra.build_extra,
152
                "build_i18n": build_i18n.build_i18n,
153
                "build_help": build_help.build_help,
154
                "build_icons": build_icons.build_icons,
155
                "lint": PocketLint,
156
                },
43 by Michael Vogt
add setup.{py,cfg} and i18n
157
      )