2014-07-15 11:39:52 +02:00
|
|
|
import ez_setup, sys, shutil, os
|
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:
|
|
|
|
os.mkdir("/usr/local/share/jsoninspector", mode = 0755)
|
|
|
|
|
|
|
|
except:
|
|
|
|
print "Warning: Couldn't create /usr/local/share/jsoninspector"
|
|
|
|
|
|
|
|
# Copy the translations
|
|
|
|
try:
|
|
|
|
copy_tree('locale/po/', '/usr/share/locale/')
|
|
|
|
|
|
|
|
except:
|
|
|
|
print "Warning: error copying translation files."
|
|
|
|
|
|
|
|
# Copy the icons
|
|
|
|
for icon_size in ['16x16', '32x32', '64x64', '128x128']:
|
|
|
|
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)
|
|
|
|
|
|
|
|
try:
|
|
|
|
shutil.copyfile('res/jsoninspector.glade', '/usr/local/share/jsoninspector/jsoninspector.desktop')
|
|
|
|
|
|
|
|
except:
|
|
|
|
print "Warning: error copyin .glade file."
|
|
|
|
|
|
|
|
try:
|
|
|
|
shutil.copyfile('res/jsoninspector.desktop', '/usr/share/applications/jsoninspector.desktop')
|
|
|
|
|
|
|
|
except:
|
|
|
|
print "Warning: error copying .desktop entry."
|
|
|
|
|
2014-07-15 09:24:59 +02:00
|
|
|
|
2010-05-27 16:29:45 +02:00
|
|
|
setup(
|
|
|
|
name = "jsoninspector",
|
2014-07-15 09:24:59 +02:00
|
|
|
version = "2.0",
|
2014-07-15 11:39:52 +02:00
|
|
|
packages = find_packages('src', exclude=['ez_setup']),
|
|
|
|
scripts = ['src/jsoninspector.py'],
|
2014-07-15 09:24:59 +02:00
|
|
|
include_package_data = True,
|
2010-05-27 16:29:45 +02:00
|
|
|
package_data = {
|
2010-05-27 16:39:40 +02:00
|
|
|
# If any package contains *.glade files, include them:
|
2014-07-15 11:39:52 +02:00
|
|
|
'src': ['*.glade'],
|
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
|
|
|
)
|