~jconti/recent-notifications/trunk

37 by Jason Conti
Reorganizing to make it easier to build a package.
1
#!/usr/bin/env python
2
40 by Jason Conti
More work to create the distutils installer.
3
import distutils
43 by Jason Conti
Can now be successfully installed, with the server.in file built into a .server file.
4
import distutils.sysconfig
40 by Jason Conti
More work to create the distutils installer.
5
43 by Jason Conti
Can now be successfully installed, with the server.in file built into a .server file.
6
from distutils.command.build import build
37 by Jason Conti
Reorganizing to make it easier to build a package.
7
from distutils.core import setup
81 by Jason Conti
Adding support for gettext translations and a pointless en_US translation as an example. Using distutils-extra to automatically build the translations and the bonobo server. Replaced the build_servers target with update_prefix. This performs basically the same as build_servers except that it will do the substitution on any .in file, and it just writes the output file without the .in, instead of adding it to the data file install list.
8
from DistUtilsExtra.command import *
43 by Jason Conti
Can now be successfully installed, with the server.in file built into a .server file.
9
from string import Template
37 by Jason Conti
Reorganizing to make it easier to build a package.
10
74 by Jason Conti
Updating website information with new location on launchpad. Minor version bump to 0.4.3.
11
from recent_notifications.Globals import VERSION, WEBSITE
54 by Jason Conti
Moved version information to Globals.py. Bumped version to 0.2.0 for next package.
12
81 by Jason Conti
Adding support for gettext translations and a pointless en_US translation as an example. Using distutils-extra to automatically build the translations and the bonobo server. Replaced the build_servers target with update_prefix. This performs basically the same as build_servers except that it will do the substitution on any .in file, and it just writes the output file without the .in, instead of adding it to the data file install list.
13
class update_prefix(distutils.cmd.Command):
14
  description = "substitute $PREFIX with the current prefix"
40 by Jason Conti
More work to create the distutils installer.
15
16
  user_options = [
81 by Jason Conti
Adding support for gettext translations and a pointless en_US translation as an example. Using distutils-extra to automatically build the translations and the bonobo server. Replaced the build_servers target with update_prefix. This performs basically the same as build_servers except that it will do the substitution on any .in file, and it just writes the output file without the .in, instead of adding it to the data file install list.
17
      ("files=", None, ".in files that should be updated")
40 by Jason Conti
More work to create the distutils installer.
18
  ]
19
20
  def initialize_options(self):
81 by Jason Conti
Adding support for gettext translations and a pointless en_US translation as an example. Using distutils-extra to automatically build the translations and the bonobo server. Replaced the build_servers target with update_prefix. This performs basically the same as build_servers except that it will do the substitution on any .in file, and it just writes the output file without the .in, instead of adding it to the data file install list.
21
    self.files = "[]"
40 by Jason Conti
More work to create the distutils installer.
22
23
  def finalize_options(self):
24
    pass
25
26
  def run(self):
27
    try:
81 by Jason Conti
Adding support for gettext translations and a pointless en_US translation as an example. Using distutils-extra to automatically build the translations and the bonobo server. Replaced the build_servers target with update_prefix. This performs basically the same as build_servers except that it will do the substitution on any .in file, and it just writes the output file without the .in, instead of adding it to the data file install list.
28
      file_set = eval(self.files)
40 by Jason Conti
More work to create the distutils installer.
29
    except:
81 by Jason Conti
Adding support for gettext translations and a pointless en_US translation as an example. Using distutils-extra to automatically build the translations and the bonobo server. Replaced the build_servers target with update_prefix. This performs basically the same as build_servers except that it will do the substitution on any .in file, and it just writes the output file without the .in, instead of adding it to the data file install list.
30
      raise Exception("Invalid files option: " + self.files)
31
32
    for file in file_set:
33
      if file.endswith(".in"):
34
        output_file = file[:-3]
35
      else:
36
        raise Exception("Invalid file: " + file)
37
38
      print "updating PREFIX in file", output_file
39
40
      with open(file, "r") as f:
41
        server_data = f.read()
42
43
      with open(output_file, "w") as f:
44
        f.write(Template(server_data).safe_substitute(PREFIX=distutils.sysconfig.PREFIX))
45
46
build.sub_commands.append(("update_prefix", None))
40 by Jason Conti
More work to create the distutils installer.
47
37 by Jason Conti
Reorganizing to make it easier to build a package.
48
setup(
44 by Jason Conti
Ignoring MANIFEST. Adding README. Renamed app so there will be no spaces in the source tar file.
49
    name="recent-notifications",
54 by Jason Conti
Moved version information to Globals.py. Bumped version to 0.2.0 for next package.
50
    version=VERSION,
37 by Jason Conti
Reorganizing to make it easier to build a package.
51
    author="Jason Conti",
52
    author_email="jason.conti@gmail.com",
74 by Jason Conti
Updating website information with new location on launchpad. Minor version bump to 0.4.3.
53
    url=WEBSITE,
37 by Jason Conti
Reorganizing to make it easier to build a package.
54
    license="GNU General Public License (GPL)",
43 by Jason Conti
Can now be successfully installed, with the server.in file built into a .server file.
55
    packages=["recent_notifications"],
56
    data_files=[
57
        ("lib/recent-notifications", ["recent-notifications"]),
98 by Jason Conti
Moving the notification- icons to scalable/status instead of scalable/apps.
58
        ("share/icons/hicolor/scalable/apps", ["icons/recent-notifications.svg"]),
59
        ("share/icons/hicolor/scalable/status", [
53 by Jason Conti
Adding new icons to setup.py. Adding urgency parsing in Monitor.Message, displaying a default icon based on the urgency level.
60
            "icons/notification-critical.svg",
61
            "icons/notification-low.svg",
62
            "icons/notification-normal.svg",
113 by Jason Conti
Adding new panel icons to better match the ubuntu humanity theme. Moved to lucid so removed the code to build karmic packages, since I can't test them at the moment.
63
            "icons/humanity-notification-read.svg",
212 by Jason Conti
Removing unused icons from the install.
64
            "icons/humanity-notification-unread.svg"])
43 by Jason Conti
Can now be successfully installed, with the server.in file built into a .server file.
65
    ],
40 by Jason Conti
More work to create the distutils installer.
66
    cmdclass={
81 by Jason Conti
Adding support for gettext translations and a pointless en_US translation as an example. Using distutils-extra to automatically build the translations and the bonobo server. Replaced the build_servers target with update_prefix. This performs basically the same as build_servers except that it will do the substitution on any .in file, and it just writes the output file without the .in, instead of adding it to the data file install list.
67
      "build": build_extra.build_extra,
68
      "build_i18n": build_i18n.build_i18n,
69
      "update_prefix": update_prefix
40 by Jason Conti
More work to create the distutils installer.
70
    }
71
)
43 by Jason Conti
Can now be successfully installed, with the server.in file built into a .server file.
72