~ubuntu-branches/debian/jessie/phatch/jessie

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Bazaar Package Importer
  • Author(s): Piotr Ożarowski, Stani M, Piotr Ożarowski
  • Date: 2008-07-21 12:53:17 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080721125317-sqk2sdl3pwl2u4gl
Tags: 0.1.5-1
[ Stani M ]
* New upstream release(Closes LP: #228259, #232436, #236282, #236462, #237359)
* debian/control:
  - Added pkg-config and python-nautilus to build-depends, as
    setup.py uses nautilus-python.pc to look for the nautilus
    extensions path. Closes: #475233.
* debian/patches:
  - All patches of Ubuntu and Debian are implemented upstream and are removed
    from the package

[ Piotr Ożarowski ]
* Bump Standards-Version to 3.8.0 (no changes needed)
* debian/copyright wrapped at column 80 (where possible)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# You should have received a copy of the GNU General Public License
17
17
# along with this program.  If not, see http://www.gnu.org/licenses/
18
18
 
19
 
import glob, os, sys
 
19
import glob, os, sys, subprocess
20
20
from distutils.core import setup
21
21
from phatch.data import info
22
22
 
24
24
#Temporarily execute the following statement if these files needs update.
25
25
#info.write_readme_credits()
26
26
 
27
 
write   = sys.stdout.write
28
 
error   = sys.stderr.write
29
 
WINDOWS = sys.platform.startswith('win')
30
 
MAC     = sys.platform.startswith('darwin')
31
 
LINUX   = sys.platform.startswith('linux')
32
 
INSTALL = len(sys.argv) > 1 and sys.argv[1] == 'install'
33
 
CLEAN   = len(sys.argv) > 1 and sys.argv[1] == 'clean'
34
 
ROOT    = os.geteuid() == 0
 
27
write               = sys.stdout.write
 
28
error               = sys.stderr.write
 
29
WINDOWS             = sys.platform.startswith('win')
 
30
MAC                 = sys.platform.startswith('darwin')
 
31
LINUX               = sys.platform.startswith('linux')
 
32
INSTALL             = len(sys.argv) > 1 and sys.argv[1] == 'install'
 
33
CLEAN               = len(sys.argv) > 1 and sys.argv[1] == 'clean'
 
34
ROOT                = os.geteuid() == 0
 
35
NAUTILUS_SCRIPTS    = ['linux/phatch_image_inspector.py',
 
36
                        'linux/phatch_recent.py',
 
37
                        ]
35
38
 
36
 
LINUX_SYMLINKS  = [
37
 
                ('phatch.png','share/pixmaps'),
38
 
                ('phatch.png','share/icons/hicolor/48x48/apps'),
39
 
                ('phatch.svg','share/icons/hicolor/scalable/apps'),
 
39
LINUX_SYMLINKS      = [
 
40
                        ('phatch.png','share/pixmaps'),
 
41
                        ('phatch.png','share/icons/hicolor/48x48/apps'),
 
42
                        ('phatch.svg','share/icons/hicolor/scalable/apps'),
40
43
            ]
41
44
 
42
45
if not WINDOWS:
68
71
]
69
72
 
70
73
#images & icons
71
 
if not WINDOWS:
 
74
if WINDOWS:
 
75
    #todo: fixme
 
76
    os_files = []
 
77
else:
72
78
    PACKAGES    += ['phatch.linux','phatch.linux.lib']
73
79
    os_files = [
74
80
        #desktop
83
89
        ('share/man/man1',['linux/phatch.1']),
84
90
        #mime type
85
91
        ('share/mime/packages',['linux/phatch.xml']),
86
 
        #nautilus extension
87
 
        ('lib/nautilus/extensions-1.0/python/',
88
 
            ['linux/phatch_image_inspector.py',
89
 
            'linux/phatch_recent.py',
90
 
            ])
91
92
    ]
92
 
    
93
93
    os_files.extend([(target,[os.path.join('images',im)]) \
94
94
        for im, target in LINUX_SYMLINKS])
95
 
        
96
 
#    if ROOT and CLEAN:
97
 
#        for im, target in LINUX_SYMLINKS:
98
 
#            link    = os.path.join(sys.prefix,target,im)
99
 
#            if os.path.exists(link):
100
 
#                try:
101
 
#                    os.remove(link)
102
 
#                except OSError:
103
 
#                    pass
104
 
else:
105
 
    os_files = []
 
95
 
 
96
if LINUX:
 
97
    #python nautilus extension integration
 
98
    #pkg-config --variable=pythondir nautilus-python
 
99
    python_nautilus_extensions_path = subprocess.Popen(
 
100
            ['pkg-config','--variable=pythondir','nautilus-python'],
 
101
            stdout=subprocess.PIPE,
 
102
        ).stdout.read().strip()
 
103
    os_files.append((python_nautilus_extensions_path, NAUTILUS_SCRIPTS))
106
104
 
107
105
dist =  setup(
108
106
            packages        = PACKAGES,
114
112
if not WINDOWS:
115
113
    # Update the mime types
116
114
    if ROOT and dist != None:
117
 
#        #symlinks
118
 
#        source = os.path.join(sys.prefix,'share/phatch/images')
119
 
#        if not CLEAN:
120
 
#            for im, target in LINUX_SYMLINKS:
121
 
#                link    = os.path.join(sys.prefix,target,im)
122
 
#                try:
123
 
#                    print 'LINK ->>',os.path.join(source,im),link
124
 
#                    os.symlink(os.path.join(source,im),link)
125
 
#                except OSError:
126
 
#                    print 'FAILED'
127
 
#                    pass
128
 
 
129
 
        #update
130
 
        from subprocess import call
131
 
 
 
115
        
132
116
        #update the mimetypes database
133
117
        try: 
134
 
            call(["update-mime-database", os.path.join(sys.prefix,"share/mime/")])
 
118
            subprocess.call(["update-mime-database", 
 
119
                os.path.join(sys.prefix,"share/mime/")])
135
120
            write('Updating the mime types database.\n')
136
121
        except:
137
122
            error('Failed to update the mime types database.\n')
138
123
 
139
124
        #update the .desktop file database
140
125
        try:
141
 
            call(["update-desktop-database"])
 
126
            subprocess.call(["update-desktop-database"])
142
127
            write('Updating the .desktop file database.\n')
143
128
        except:
144
129
            error('Failed to update the .desktop file database.\n')