2014-07-15 11:55:16 +02:00
|
|
|
import ez_setup, sys, shutil, os, os.path
|
2014-07-15 09:24:59 +02:00
|
|
|
ez_setup.use_setuptools()
|
2010-05-27 16:29:45 +02:00
|
|
|
|
|
|
|
from setuptools import setup, find_packages
|
2014-07-15 11:39:52 +02:00
|
|
|
from setuptools.command.install import install
|
|
|
|
from distutils.dir_util import copy_tree
|
|
|
|
|
|
|
|
class CustomInstall(install):
|
|
|
|
"""
|
|
|
|
We subclass the install command to add some more mojo
|
|
|
|
"""
|
|
|
|
def run(self):
|
|
|
|
install.run(self) # Do the usual setuptools magic
|
|
|
|
# Now we do our own magic
|
|
|
|
if sys.platform != 'win32' and sys.platform != 'darwin':
|
|
|
|
try:
|
2014-07-15 11:55:16 +02:00
|
|
|
print "Creating shared directory..."
|
2014-07-15 11:39:52 +02:00
|
|
|
os.mkdir("/usr/local/share/jsoninspector", mode = 0755)
|
|
|
|
|
|
|
|
except:
|
2014-07-15 11:55:16 +02:00
|
|
|
if not os.path.exists("/usr/local/share/jsoninspector"):
|
|
|
|
print "Warning: Couldn't create /usr/local/share/jsoninspector"
|
2014-07-15 11:39:52 +02:00
|
|
|
|
|
|
|
# Copy the translations
|
|
|
|
try:
|
2014-07-15 11:55:16 +02:00
|
|
|
print "Installing translations..."
|
2014-07-15 11:39:52 +02:00
|
|
|
copy_tree('locale/po/', '/usr/share/locale/')
|
|
|
|
|
|
|
|
except:
|
|
|
|
print "Warning: error copying translation files."
|
|
|
|
|
|
|
|
# Copy the icons
|
2014-07-15 11:55:16 +02:00
|
|
|
print "Installing application icons..."
|
|
|
|
for icon_size in ['16x16', '32x32', '48x48', '64x64', '128x128']:
|
2014-07-15 11:39:52 +02:00
|
|
|
try:
|
|
|
|
shutil.copyfile('res/jsoninspector' + icon_size + ".png",
|
|
|
|
'/usr/share/icons/hicolor/' + icon_size + "/apps/jsoninspector.png")
|
|
|
|
|
|
|
|
except:
|
|
|
|
print "Warning: error copying icon {size}.".format(icon_size)
|
|
|
|
|
2014-07-15 12:43:08 +02:00
|
|
|
try:
|
|
|
|
shutil.copyfile('res/jsoninspector48x48.png', '/usr/share/pixmaps/jsoninspector.png')
|
|
|
|
|
|
|
|
except:
|
|
|
|
print "Warning: error copying icon to pixmaps directory."
|
|
|
|
|
2014-07-15 11:39:52 +02:00
|
|
|
try:
|
2014-07-15 11:55:16 +02:00
|
|
|
print "Installing glade file..."
|
2014-07-15 11:39:52 +02:00
|
|
|
shutil.copyfile('res/jsoninspector.glade', '/usr/local/share/jsoninspector/jsoninspector.desktop')
|
|
|
|
|
|
|
|
except:
|
2014-07-15 11:55:16 +02:00
|
|
|
print "Warning: error copying .glade file."
|
2014-07-15 11:39:52 +02:00
|
|
|
|
|
|
|
try:
|
2014-07-15 11:55:16 +02:00
|
|
|
print "Installing desktop entry..."
|
2014-07-15 11:39:52 +02:00
|
|
|
shutil.copyfile('res/jsoninspector.desktop', '/usr/share/applications/jsoninspector.desktop')
|
|
|
|
|
|
|
|
except:
|
|
|
|
print "Warning: error copying .desktop entry."
|
|
|
|
|
2010-05-27 16:29:45 +02:00
|
|
|
setup(
|
2014-07-15 13:53:28 +02:00
|
|
|
name = "Jsoninspector",
|
2014-07-15 09:24:59 +02:00
|
|
|
version = "2.0",
|
2014-07-15 13:53:28 +02:00
|
|
|
packages = find_packages('src', exclude = ['ez_setup']),
|
|
|
|
entry_points = { 'gui_scripts' : [ 'jsoninspector = jsoninspector:main_start' ] },
|
|
|
|
package_dir = { '' : 'src' },
|
2010-05-27 16:29:45 +02:00
|
|
|
# metadata for upload to PyPI
|
|
|
|
author = "Jose Carlos Cuevas",
|
|
|
|
author_email = "reset.reboot@gmail.com",
|
|
|
|
description = "JSON Inspector is a simple application to study JSON code",
|
|
|
|
license = "GPLv3",
|
|
|
|
keywords = "json inspect gtk gnome",
|
2014-07-14 08:16:19 +02:00
|
|
|
url = "https://github.com/resetreboot/jsoninspector", # project home page, if any
|
2014-07-15 11:39:52 +02:00
|
|
|
cmdclass = { 'install' : CustomInstall }
|
2010-05-27 16:29:45 +02:00
|
|
|
)
|