~flimm/epidermis/icon-theme-bugfix

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: David D Lowe
  • Date: 2010-03-16 12:53:50 UTC
  • Revision ID: daviddlowe.flimm@gmail.com-20100316125350-61gh2mo150n4lj1s
Fixed setup.py:
* It knows about the new location of data/ in the source tree.
* It preserves file permissions when copying .py files.
* It handles non-ascii characters in the output .policy file.
MANIFEST.in includes all the correct files including moved data/ directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
from distutils.core import setup
6
6
from distutils.command.build import build
 
7
from distutils.command.build_py import build_py
7
8
from distutils.core import Command
8
9
import distutils.command.clean
9
10
import distutils.command.sdist
27
28
    print >> sys.stderr, "Could not find version, because python couldn't import epidermis.const"
28
29
    raise
29
30
 
30
 
 
31
31
def main():
32
32
    
33
 
    data_files = glob.glob("epidermis/data/*")  # data_files a list of strings
 
33
    data_files = glob.glob("data/*")  # data_files a list of strings
34
34
    # of the relative paths of all non-py files that should be included
35
 
    # ex: data_files is ['epidermis/data/creator.glade', 'epidermis/data/epidermis.glade', ...]
 
35
    # ex: data_files is ['data/creator.glade', 'data/epidermis.glade', ...]
36
36
    
37
37
    # Check python version
38
38
    if sys.version < '2.6' or sys.version >= '3.0':
52
52
    data_files=[('share/epidermis/data/', data_files), 
53
53
        ('/etc/', ['linux/epidermis.conf']),
54
54
        ('share/applications', ['build/i18n/epidermis.desktop']),
55
 
        ('/usr/share/pixmaps', ['epidermis/data/epidermis.svg']),
 
55
        ('/usr/share/pixmaps', ['data/epidermis.svg']),
56
56
        ('/usr/share/icons/gnome/scalable/mimetypes', ['linux/gnome-mime-application-x-pigment.svg']),
57
57
        ('/usr/share/icons/gnome/32x32/mimetypes', ['linux/gnome-mime-application-x-pigment.png']),
58
58
        ('/usr/share/gconf/schemas', ['linux/epidermis.schemas']),
74
74
Epidermis was written in python with pygtk.
75
75
Find more information at http://epidermis.tuxfamily.org and https://launchpad.net/epidermis/""",
76
76
    cmdclass={"build":build_with_options,
 
77
              "build_py": build_py_keep_permissions,
77
78
              "build_dbus_service":build_dbus_service,
78
79
              "build_mo":build_mo,
79
80
              "clean":total_clean,
95
96
    def finalize_options(self):
96
97
        build.finalize_options(self)
97
98
 
 
99
class build_py_keep_permissions(build_py):
 
100
    def copy_file(self, infile, outfile,
 
101
                  preserve_mode=1, preserve_times=1, link=None, level=1):
 
102
        """Override preserve_mode and set it to 1"""
 
103
        build_py.copy_file(self, infile=infile, outfile=outfile, preserve_mode=1,
 
104
            preserve_times=preserve_times, link=link, level=level)
 
105
 
98
106
class build_dbus_service(Command):
99
107
    description = "Build DBus .service file, modifying it so that it points to the correct script"
100
108
    user_options = []
224
232
                    node.setAttribute("xml:lang", trans)
225
233
                    newtext = translations[trans].gettext(text)
226
234
                    if newtext:
227
 
                        node.appendChild(policy.createTextNode(newtext))
 
235
                        node.appendChild(policy.createTextNode(newtext.decode('utf-8')))
228
236
                        action.appendChild(node)
229
 
                        action.appendChild(policy.createTextNode("\n"))
 
237
                        action.appendChild(policy.createTextNode("\n".decode('utf-8')))
 
238
        output = policy.toxml()
230
239
        open("build/i18n/org.tuxfamily.epidermis.shell.policy","w").write(
231
 
            policy.toxml().encode('utf-8'))
 
240
            output.encode('utf-8'))
232
241
        
233
242
        # add i18n strings to .desktop file (build it)
234
243
        output = ""