~mvo/software-center/lp967036-2

43 by Michael Vogt
add setup.{py,cfg} and i18n
1
#!/usr/bin/env python
2
2701.1.8 by Michael Vogt
add ubuntu-extras channel file to allow adding it back if for some reasons its no longer there for a user, this requires a new dependency on ubuntu-extras-keyring to ensure we have the gpg key for the channel
3
import platform
1301 by Michael Vogt
* setup.py:
4
import distutils
5
import fnmatch
43 by Michael Vogt
add setup.{py,cfg} and i18n
6
import glob
7
import os
1301 by Michael Vogt
* setup.py:
8
import re
2701.1.8 by Michael Vogt
add ubuntu-extras channel file to allow adding it back if for some reasons its no longer there for a user, this requires a new dependency on ubuntu-extras-keyring to ensure we have the gpg key for the channel
9
from subprocess import call
284 by Michael Vogt
* setup.py:
10
import sys
11
1301 by Michael Vogt
* setup.py:
12
from distutils.core import setup
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
13
from DistUtilsExtra.command import (build_extra, build_i18n, build_help,
14
                                    build_icons)
15
1301 by Michael Vogt
* setup.py:
16
17
class PocketLint(distutils.cmd.Command):
18
    """ command class that runs pocketlint """
19
    user_options = []
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
20
1301 by Michael Vogt
* setup.py:
21
    def initialize_options(self):
22
        pass
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
23
1301 by Michael Vogt
* setup.py:
24
    def finalize_options(self):
25
        pass
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
26
1301 by Michael Vogt
* setup.py:
27
    def binary_in_path(self, binary):
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
28
        return any([os.path.exists(os.path.join(p, binary))
1301 by Michael Vogt
* setup.py:
29
                    for p in os.environ["PATH"].split(":")])
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
30
1301 by Michael Vogt
* setup.py:
31
    def run(self):
32
        if not self.binary_in_path("pocketlint"):
33
            sys.stderr.write("No pocketlint found in path\n"
34
                             "Use python-pocket-lint in natty or from "
35
                             "ppa:sinzui\n")
36
            return
37
        py_files = []
38
        for root, dirs, files in os.walk("."):
39
            pyl = fnmatch.filter(files, "*.py")
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
40
            py_files.extend([os.path.join(root, f) for f in pyl
41
                             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
42
        call(["pocketlint"] + py_files)
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
43
44
1395 by Michael Vogt
include full AUTHORS info into the about dialog,
45
def merge_authors_into_about_dialog():
2338.1.5 by Michael Vogt
pyflake fixes, remove unneeded symlinks
46
    fname = "./data/ui/gtk3/SoftwareCenter.ui"
2338.1.2 by Michael Vogt
remove gtk2 glade files, simplify imports
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
2863.1.1 by Michael Vogt
make softwarecenter/*.py pep8 clean
54
2701.1.8 by Michael Vogt
add ubuntu-extras channel file to allow adding it back if for some reasons its no longer there for a user, this requires a new dependency on ubuntu-extras-keyring to ensure we have the gpg key for the channel
55
def merge_extras_ubuntu_com_channel_file():
56
    # update ubuntu-extras.list.in (this will not be part of debian as
57
    # its killed of in debian/rules on a non-ubuntu build)
58
    DISTROSERIES = platform.dist()[2]
59
    channelfile = "data/channels/Ubuntu/ubuntu-extras.list"
2863.1.1 by Michael Vogt
make softwarecenter/*.py pep8 clean
60
    s = open(channelfile + ".in").read()
2701.1.8 by Michael Vogt
add ubuntu-extras channel file to allow adding it back if for some reasons its no longer there for a user, this requires a new dependency on ubuntu-extras-keyring to ensure we have the gpg key for the channel
61
    open(channelfile, "w").write(s.replace("#DISTROSERIES#", DISTROSERIES))
2863.1.1 by Michael Vogt
make softwarecenter/*.py pep8 clean
62
1395 by Michael Vogt
include full AUTHORS info into the about dialog,
63
284 by Michael Vogt
* setup.py:
64
# update version.py
65
line = open("debian/changelog").readline()
502 by Michael Vogt
setup.py: deal with codenames like karmic-proposed
66
m = re.match("^[\w-]+ \(([\w\.~]+)\) ([\w-]+);", line)
284 by Michael Vogt
* setup.py:
67
VERSION = m.group(1)
68
CODENAME = m.group(2)
2701.1.8 by Michael Vogt
add ubuntu-extras channel file to allow adding it back if for some reasons its no longer there for a user, this requires a new dependency on ubuntu-extras-keyring to ensure we have the gpg key for the channel
69
DISTRO = platform.dist()[0]
70
RELEASE = platform.dist()[1]
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
71
open("softwarecenter/version.py", "w").write("""
284 by Michael Vogt
* setup.py:
72
VERSION='%s'
73
CODENAME='%s'
74
DISTRO='%s'
75
RELEASE='%s'
76
""" % (VERSION, CODENAME, DISTRO, RELEASE))
77
2701.1.8 by Michael Vogt
add ubuntu-extras channel file to allow adding it back if for some reasons its no longer there for a user, this requires a new dependency on ubuntu-extras-keyring to ensure we have the gpg key for the channel
78
574 by Michael Vogt
* po/help/po4a.conf:
79
# update po4a
80
if sys.argv[1] == "build":
1395 by Michael Vogt
include full AUTHORS info into the about dialog,
81
    merge_authors_into_about_dialog()
2701.1.8 by Michael Vogt
add ubuntu-extras channel file to allow adding it back if for some reasons its no longer there for a user, this requires a new dependency on ubuntu-extras-keyring to ensure we have the gpg key for the channel
82
    merge_extras_ubuntu_com_channel_file()
574 by Michael Vogt
* po/help/po4a.conf:
83
    call(["po4a", "po/help/po4a.conf"])
284 by Michael Vogt
* setup.py:
84
574 by Michael Vogt
* po/help/po4a.conf:
85
# real setup
330 by Michael Vogt
renamed to "Ubuntu Software Center" and software-center (LP: #436648)
86
setup(name="software-center", version=VERSION,
87
      scripts=["software-center",
2040 by Michael Vogt
* setup.py:
88
               # gtk3
89
               "utils/submit_review_gtk3.py",
90
               "utils/report_review_gtk3.py",
91
               "utils/submit_usefulness_gtk3.py",
92
               "utils/delete_review_gtk3.py",
93
               "utils/modify_review_gtk3.py",
94
               # db helpers
330 by Michael Vogt
renamed to "Ubuntu Software Center" and software-center (LP: #436648)
95
               "utils/update-software-center",
2617.2.2 by Michael Vogt
move channels-check/update code into a seperate script to avoid UI stall
96
               "utils/update-software-center-channels",
858.2.47 by Michael Vogt
utils/update-software-center-agent: fix imports; setup.py: add u-s-c-agent script
97
               "utils/update-software-center-agent",
2788.1.3 by Michael Vogt
actually call the expunge-helper.py from s-c
98
               # generic helpers
99
               "utils/expunge-cache.py",
2077 by Michael Vogt
some pep8 fixes, but probably not worth the trouble going through all of them
100
               ] + glob.glob("utils/piston-helpers/*.py"),
101
      packages=['softwarecenter',
102
                'softwarecenter.backend',
1809.1.51 by Alex Eftimie
fixed python setup.py build failing from not finding aptd.py
103
                'softwarecenter.backend.installbackend_impl',
2402 by Michael Vogt
setup.py: add missing softwarecenter.backend.channel_impl
104
                'softwarecenter.backend.channel_impl',
2548.1.1 by Kiwinote
* setup.py:
105
                'softwarecenter.backend.oneconfhandler',
2077 by Michael Vogt
some pep8 fixes, but probably not worth the trouble going through all of them
106
                'softwarecenter.backend.piston',
2548.1.1 by Kiwinote
* setup.py:
107
                'softwarecenter.backend.reviews',
2077 by Michael Vogt
some pep8 fixes, but probably not worth the trouble going through all of them
108
                'softwarecenter.db',
109
                'softwarecenter.db.pkginfo_impl',
110
                'softwarecenter.db.history_impl',
111
                'softwarecenter.distro',
112
                'softwarecenter.ui',
113
                'softwarecenter.ui.gtk3',
114
                'softwarecenter.ui.gtk3.dialogs',
115
                'softwarecenter.ui.gtk3.models',
116
                'softwarecenter.ui.gtk3.panes',
117
                'softwarecenter.ui.gtk3.session',
118
                'softwarecenter.ui.gtk3.views',
119
                'softwarecenter.ui.gtk3.widgets',
120
                'softwarecenter.ui.qml',
121
                ],
43 by Michael Vogt
add setup.{py,cfg} and i18n
122
      data_files=[
2020 by Michael Vogt
install gtk3 version as software-center-gtk3 tech preview
123
                  # gtk3
124
                  ('share/software-center/ui/gtk3/',
125
                   glob.glob("data/ui/gtk3/*.ui")),
126
                  ('share/software-center/ui/gtk3/css/',
127
                   glob.glob("data/ui/gtk3/css/*.css")),
128
                  ('share/software-center/ui/gtk3/art/',
129
                   glob.glob("data/ui/gtk3/art/*.png")),
130
                  ('share/software-center/ui/gtk3/art/icons',
131
                   glob.glob("data/ui/gtk3/art/icons/*.png")),
2051 by Michael Vogt
setup.py: install the offline banners too
132
                  ('share/software-center/default_banner',
133
                   glob.glob("data/default_banner/*")),
2020 by Michael Vogt
install gtk3 version as software-center-gtk3 tech preview
134
                  # dbus
286 by Michael Vogt
implement dbus service that informs the GUI if the database
135
                  ('../etc/dbus-1/system.d/',
330 by Michael Vogt
renamed to "Ubuntu Software Center" and software-center (LP: #436648)
136
                   ["data/com.ubuntu.SoftwareCenter.conf"]),
2020 by Michael Vogt
install gtk3 version as software-center-gtk3 tech preview
137
                  # images
359.1.1 by Michael Vogt
* softwarecenter/view/appdetailsview.py:
138
                  ('share/software-center/images/',
2077 by Michael Vogt
some pep8 fixes, but probably not worth the trouble going through all of them
139
                   glob.glob("data/images/*.png") +
1302 by Michael Vogt
setup.py: improve lint target, make it (pocket)lint clean
140
                   glob.glob("data/images/*.gif")),
403 by Michael Vogt
install the softwarecenter-installed emblem into a private dir
141
                  ('share/software-center/icons/',
142
                   glob.glob("data/emblems/*.png")),
2701.1.8 by Michael Vogt
add ubuntu-extras channel file to allow adding it back if for some reasons its no longer there for a user, this requires a new dependency on ubuntu-extras-keyring to ensure we have the gpg key for the channel
143
                  # xapian
560 by Michael Vogt
* apt-xapian-index-plugin/software-center.py:
144
                  ('share/apt-xapian-index/plugins',
145
                   glob.glob("apt-xapian-index-plugin/*.py")),
2020 by Michael Vogt
install gtk3 version as software-center-gtk3 tech preview
146
                  # apport
1839 by Michael Vogt
add in an apport package hook for software-center that adds
147
                  ('share/apport/package-hooks/',
148
                   ['debian/source_software-center.py']),
2701.1.8 by Michael Vogt
add ubuntu-extras channel file to allow adding it back if for some reasons its no longer there for a user, this requires a new dependency on ubuntu-extras-keyring to ensure we have the gpg key for the channel
149
                  # extra software channels (can be distro specific)
150
                  ('/usr/share/app-install/channels/',
2863.1.1 by Michael Vogt
make softwarecenter/*.py pep8 clean
151
                   glob.glob("data/channels/%s/*" % DISTRO)),
43 by Michael Vogt
add setup.{py,cfg} and i18n
152
                  ],
2077 by Michael Vogt
some pep8 fixes, but probably not worth the trouble going through all of them
153
      cmdclass={"build": build_extra.build_extra,
154
                "build_i18n": build_i18n.build_i18n,
155
                "build_help": build_help.build_help,
156
                "build_icons": build_icons.build_icons,
157
                "lint": PocketLint,
158
                },
43 by Michael Vogt
add setup.{py,cfg} and i18n
159
      )