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/
19
import glob, os, sys, subprocess
20
20
from distutils.core import setup
21
21
from phatch.data import info
24
24
#Temporarily execute the following statement if these files needs update.
25
25
#info.write_readme_credits()
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
('phatch.png','share/pixmaps'),
38
('phatch.png','share/icons/hicolor/48x48/apps'),
39
('phatch.svg','share/icons/hicolor/scalable/apps'),
40
('phatch.png','share/pixmaps'),
41
('phatch.png','share/icons/hicolor/48x48/apps'),
42
('phatch.svg','share/icons/hicolor/scalable/apps'),
83
89
('share/man/man1',['linux/phatch.1']),
85
91
('share/mime/packages',['linux/phatch.xml']),
87
('lib/nautilus/extensions-1.0/python/',
88
['linux/phatch_image_inspector.py',
89
'linux/phatch_recent.py',
93
93
os_files.extend([(target,[os.path.join('images',im)]) \
94
94
for im, target in LINUX_SYMLINKS])
97
# for im, target in LINUX_SYMLINKS:
98
# link = os.path.join(sys.prefix,target,im)
99
# if os.path.exists(link):
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))
108
106
packages = PACKAGES,
115
113
# Update the mime types
116
114
if ROOT and dist != None:
118
# source = os.path.join(sys.prefix,'share/phatch/images')
120
# for im, target in LINUX_SYMLINKS:
121
# link = os.path.join(sys.prefix,target,im)
123
# print 'LINK ->>',os.path.join(source,im),link
124
# os.symlink(os.path.join(source,im),link)
130
from subprocess import call
132
116
#update the mimetypes database
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')
137
122
error('Failed to update the mime types database.\n')
139
124
#update the .desktop file database
141
call(["update-desktop-database"])
126
subprocess.call(["update-desktop-database"])
142
127
write('Updating the .desktop file database.\n')
144
129
error('Failed to update the .desktop file database.\n')