From 6a5a78eee0c61f0d43732c285f0871df7c92ed96 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Thu, 31 Jan 2013 22:41:10 +0000 Subject: [PATCH] Fix for --install-scripts option and new --server option svn: r21264 --- scripts/gramps | 3 + setup.py | 302 +++++++++++++++++++++++++++---------------------- 2 files changed, 172 insertions(+), 133 deletions(-) create mode 100644 scripts/gramps diff --git a/scripts/gramps b/scripts/gramps new file mode 100644 index 000000000..a4842e518 --- /dev/null +++ b/scripts/gramps @@ -0,0 +1,3 @@ +#!/usr/bin/env python +import gramps.grampsapp as app +app.main() diff --git a/setup.py b/setup.py index 346b50f41..60875eabb 100644 --- a/setup.py +++ b/setup.py @@ -53,6 +53,11 @@ ALL_LINGUAS = ('bg', 'ca', 'cs', 'da', 'de', 'el', 'en_GB', 'es', 'fi', 'fr', 'h 'pt_PT', 'ru', 'sk', 'sl', 'sq', 'sv', 'uk', 'vi', 'zh_CN') INTLTOOL_FILES = ('data/tips.xml', 'gramps/plugins/lib/holidays.xml') +server = False +if '--server' in sys.argv: + sys.argv.remove('--server') + server = True + def intltool_version(): ''' Return the version of intltool as a tuple. @@ -204,35 +209,6 @@ def merge(in_file, out_file, option, po_dir='po', cache=True): out_file) raise SystemExit(msg) -def install_template(install_cmd): - ''' - Pre-install hook to populate template files. - ''' - build_scripts = os.path.join(install_cmd.build_base, 'scripts') - if not(os.path.isdir(build_scripts) or os.path.islink(build_scripts)): - os.makedirs(build_scripts) - data_files = install_cmd.distribution.data_files - write_gramps_script(install_cmd, build_scripts) - data_files.append(('bin', [install_cmd.build_base + '/scripts/gramps'])) - write_const_py(install_cmd) - -def write_gramps_script(install_cmd, build_scripts): - ''' - Write the build/scripts/gramps file. - ''' - filename = os.path.join(build_scripts, 'gramps') - f_out = open(filename, 'w') - f_out.write('#!/usr/bin/env python\n') - f_out.write('import gramps.grampsapp as app\n') - f_out.write('app.main()\n') - f_out.close() - - if os.name == 'posix': - # set read and execute bits - mode = ((os.stat(filename).st_mode) | 0o555) & 0o7777 - log.info('changing mode of %s to %o', filename, mode) - os.chmod(filename, mode) - def write_const_py(command): ''' Write the const.py file. @@ -304,29 +280,104 @@ class install(_install): self.enable_packager_mode = False def run(self): - install_template(self) + write_const_py(self) _install.run(self) if self.enable_packager_mode: log.warn('WARNING: Packager mode enabled. Post-installation mime ' 'type processing was not run.') else: update_posix() + +#------------------------------------------------------------------------- +# +# Packages +# +#------------------------------------------------------------------------- +package_core = ['gramps', + 'gramps.cli', + 'gramps.cli.plug', + 'gramps.gen.utils.docgen', + 'gramps.gen', + 'gramps.gen.datehandler', + 'gramps.gen.db', + 'gramps.gen.display', + 'gramps.gen.filters', + 'gramps.gen.filters.rules', + 'gramps.gen.filters.rules.citation', + 'gramps.gen.filters.rules.event', + 'gramps.gen.filters.rules.family', + 'gramps.gen.filters.rules.media', + 'gramps.gen.filters.rules.note', + 'gramps.gen.filters.rules.person', + 'gramps.gen.filters.rules.place', + 'gramps.gen.filters.rules.repository', + 'gramps.gen.filters.rules.source', + 'gramps.gen.lib', + 'gramps.gen.merge', + 'gramps.gen.mime', + 'gramps.gen.plug', + 'gramps.gen.plug.docbackend', + 'gramps.gen.plug.docgen', + 'gramps.gen.plug.menu', + 'gramps.gen.plug.report', + 'gramps.gen.proxy', + 'gramps.gen.simple', + 'gramps.gen.utils', + 'gramps.gen.utils.docgen', + 'gramps.test', + 'gramps.plugins', + 'gramps.plugins.docgen', + 'gramps.plugins.drawreport', + 'gramps.plugins.export', + 'gramps.plugins.gramplet', + 'gramps.plugins.graph', + 'gramps.plugins.importer', + 'gramps.plugins.lib', + 'gramps.plugins.lib.maps', + 'gramps.plugins.mapservices', + 'gramps.plugins.quickview', + 'gramps.plugins.rel', + 'gramps.plugins.sidebar', + 'gramps.plugins.textreport', + 'gramps.plugins.tool', + 'gramps.plugins.view', + 'gramps.plugins.webreport', + 'gramps.plugins.webstuff', + ] +package_gui = ['gramps.gui', + 'gramps.gui.editors', + 'gramps.gui.editors.displaytabs', + 'gramps.gui.filters', + 'gramps.gui.filters.sidebar', + 'gramps.gui.logger', + 'gramps.gui.merge', + 'gramps.gui.plug', + 'gramps.gui.plug.export', + 'gramps.gui.plug.quick', + 'gramps.gui.plug.report', + 'gramps.gui.selectors', + 'gramps.gui.views', + 'gramps.gui.views.treemodels', + 'gramps.gui.widgets', + ] +package_webapp = ['gramps.webapp', + 'gramps.webapp.grampsdb', + 'gramps.webapp.grampsdb.templatetags', + 'gramps.webapp.grampsdb.view', + ] +if server: + packages = package_core + package_webapp +else: + packages = package_core + package_gui -DOC_FILES = ['AUTHORS', 'COPYING', 'FAQ', 'INSTALL', 'LICENSE', 'NEWS', - 'README', 'TODO'] -GEDCOM_FILES = glob.glob(os.path.join('example', 'gedcom', '*.*')) -GRAMPS_FILES = glob.glob(os.path.join('example', 'gramps', '*.*')) -PNG_FILES = glob.glob(os.path.join('data', '*.png')) -SVG_FILES = glob.glob(os.path.join('data', '*.svg')) -XML_FILES = glob.glob(os.path.join('data', '*.xml')) -IMAGE_FILES = glob.glob(os.path.join('images', '*.*')) -IMAGE_16 = glob.glob(os.path.join('images', '16x16', '*.png')) -IMAGE_22 = glob.glob(os.path.join('images', '22x22', '*.png')) -IMAGE_48 = glob.glob(os.path.join('images', '48x48', '*.png')) -IMAGE_SC = glob.glob(os.path.join('images', 'scalable', '*.svg')) +#------------------------------------------------------------------------- +# +# Package data +# +#------------------------------------------------------------------------- -data_list = ['gui/glade/*.glade'] # add all subdirs of plugin with glade: +package_data_core = [] basedir = os.path.join('gramps', 'plugins') for (dirpath, dirnames, filenames) in os.walk(basedir): root, subdir = os.path.split(dirpath) @@ -338,16 +389,78 @@ for (dirpath, dirnames, filenames) in os.walk(basedir): if dirname.startswith("."): dirnames.remove(dirname) #we add to data_list so glade , xml, files are found, we don't need the gramps/ part - data_list.append(dirpath[7:] + '/' + dirname + '/*.glade') - data_list.append(dirpath[7:] + '/' + dirname + '/*.xml') - data_list.append(dirpath[7:] + '/' + dirname + '/*.png') - data_list.append(dirpath[7:] + '/' + dirname + '/*.svg') - data_list.append(dirpath[7:] + '/' + dirname + '/*.css') - data_list.append(dirpath[7:] + '/' + dirname + '/*.html') - data_list.append(dirpath[7:] + '/' + dirname + '/*.js') -data_list.append('plugins/webstuff/images/*.gif') -data_list.append('plugins/webstuff/images/*.ico') + package_data_core.append(dirpath[7:] + '/' + dirname + '/*.glade') + package_data_core.append(dirpath[7:] + '/' + dirname + '/*.xml') + package_data_core.append(dirpath[7:] + '/' + dirname + '/*.png') + package_data_core.append(dirpath[7:] + '/' + dirname + '/*.svg') + package_data_core.append(dirpath[7:] + '/' + dirname + '/*.css') + package_data_core.append(dirpath[7:] + '/' + dirname + '/*.html') + package_data_core.append(dirpath[7:] + '/' + dirname + '/*.js') +package_data_core.append('plugins/webstuff/images/*.gif') +package_data_core.append('plugins/webstuff/images/*.ico') +package_data_gui = ['gui/glade/*.glade'] + +package_data_webapp = ['webapp/*.sql', 'webapp/grampsdb/sql/*.sql'] + +if server: + package_data = package_data_core + package_data_webapp +else: + package_data = package_data_core + package_data_gui + +#------------------------------------------------------------------------- +# +# Resources +# +#------------------------------------------------------------------------- +data_files_core = [('share/mime-info', ['data/gramps.mime']), + ('share/icons', ['images/gramps.png'])] +DOC_FILES = ['AUTHORS', 'COPYING', 'FAQ', 'INSTALL', 'LICENSE', 'NEWS', + 'README', 'TODO'] +GEDCOM_FILES = glob.glob(os.path.join('example', 'gedcom', '*.*')) +GRAMPS_FILES = glob.glob(os.path.join('example', 'gramps', '*.*')) +data_files_core.append(('share/doc/gramps', DOC_FILES)) +data_files_core.append(('share/doc/gramps/example/gedcom', GEDCOM_FILES)) +data_files_core.append(('share/doc/gramps/example/gramps', GRAMPS_FILES)) + +PNG_FILES = glob.glob(os.path.join('data', '*.png')) +SVG_FILES = glob.glob(os.path.join('data', '*.svg')) +data_files_core.append(('share/icons/gnome/48x48/mimetypes', PNG_FILES)) +data_files_core.append(('share/icons/gnome/scalable/mimetypes', SVG_FILES)) + +XML_FILES = glob.glob(os.path.join('data', '*.xml')) +data_files_core.append(('share/gramps', XML_FILES)) + +data_files_gui = [] +IMAGE_FILES = glob.glob(os.path.join('images', '*.*')) +IMAGE_16 = glob.glob(os.path.join('images', '16x16', '*.png')) +IMAGE_22 = glob.glob(os.path.join('images', '22x22', '*.png')) +IMAGE_48 = glob.glob(os.path.join('images', '48x48', '*.png')) +IMAGE_SC = glob.glob(os.path.join('images', 'scalable', '*.svg')) +data_files_gui.append(('share/gramps/icons/hicolor', IMAGE_FILES)) +data_files_gui.append(('share/gramps/icons/hicolor/16x16', IMAGE_16)) +data_files_gui.append(('share/gramps/icons/hicolor/22x22', IMAGE_22)) +data_files_gui.append(('share/gramps/icons/hicolor/48x48', IMAGE_48)) +data_files_gui.append(('share/gramps/icons/hicolor/scalable', IMAGE_SC)) + +data_files_webapp = [] +TEMPLATE_FILES = glob.glob(os.path.join('data/templates', '*.html')) +data_files_webapp.append(('share/gramps/templates', TEMPLATE_FILES)) +ADMIN_FILES = glob.glob(os.path.join('data/templates/admin', '*.html')) +data_files_webapp.append(('share/gramps/templates/admin', ADMIN_FILES)) +REG_FILES = glob.glob(os.path.join('data/templates/registration', '*.html')) +data_files_webapp.append(('share/gramps/templates/registration', REG_FILES)) + +if server: + data_files = data_files_core + data_files_webapp +else: + data_files = data_files_core + data_files_gui + +#------------------------------------------------------------------------- +# +# Setup +# +#------------------------------------------------------------------------- setup(name = 'gramps', description = ('Gramps (Genealogical Research and Analysis Management ' 'Programming System)'), @@ -364,85 +477,8 @@ setup(name = 'gramps', license = 'GPL v2 or greater', platforms = ['FreeBSD', 'Linux', 'MacOS', 'Windows'], cmdclass = {'build': build, 'install': install}, - packages = ['gramps', - 'gramps.cli', - 'gramps.cli.plug', - 'gramps.gen.utils.docgen', - 'gramps.gen', - 'gramps.gen.datehandler', - 'gramps.gen.db', - 'gramps.gen.display', - 'gramps.gen.filters', - 'gramps.gen.filters.rules', - 'gramps.gen.filters.rules.citation', - 'gramps.gen.filters.rules.event', - 'gramps.gen.filters.rules.family', - 'gramps.gen.filters.rules.media', - 'gramps.gen.filters.rules.note', - 'gramps.gen.filters.rules.person', - 'gramps.gen.filters.rules.place', - 'gramps.gen.filters.rules.repository', - 'gramps.gen.filters.rules.source', - 'gramps.gen.lib', - 'gramps.gen.merge', - 'gramps.gen.mime', - 'gramps.gen.plug', - 'gramps.gen.plug.docbackend', - 'gramps.gen.plug.docgen', - 'gramps.gen.plug.menu', - 'gramps.gen.plug.report', - 'gramps.gen.proxy', - 'gramps.gen.simple', - 'gramps.gen.utils', - 'gramps.gen.utils.docgen', - 'gramps.gui', - 'gramps.gui.editors', - 'gramps.gui.editors.displaytabs', - 'gramps.gui.filters', - 'gramps.gui.filters.sidebar', - 'gramps.gui.logger', - 'gramps.gui.merge', - 'gramps.gui.plug', - 'gramps.gui.plug.export', - 'gramps.gui.plug.quick', - 'gramps.gui.plug.report', - 'gramps.gui.selectors', - 'gramps.gui.views', - 'gramps.gui.views.treemodels', - 'gramps.gui.widgets', - 'gramps.test', - 'gramps.plugins', - 'gramps.plugins.docgen', - 'gramps.plugins.drawreport', - 'gramps.plugins.export', - 'gramps.plugins.gramplet', - 'gramps.plugins.graph', - 'gramps.plugins.importer', - 'gramps.plugins.lib', - 'gramps.plugins.lib.maps', - 'gramps.plugins.mapservices', - 'gramps.plugins.quickview', - 'gramps.plugins.rel', - 'gramps.plugins.sidebar', - 'gramps.plugins.textreport', - 'gramps.plugins.tool', - 'gramps.plugins.view', - 'gramps.plugins.webreport', - 'gramps.plugins.webstuff', - ], - package_data={'gramps': data_list}, - data_files=[('share/mime-info', ['data/gramps.mime']), - ('share/icons/gnome/48x48/mimetypes', PNG_FILES), - ('share/icons/gnome/scalable/mimetypes', SVG_FILES), - ('share/icons', ['images/gramps.png']), - ('share/doc/gramps/example/gedcom', GEDCOM_FILES), - ('share/doc/gramps/example/gramps', GRAMPS_FILES), - ('share/doc/gramps', DOC_FILES), - ('share/gramps', XML_FILES), - ('share/gramps/icons/hicolor', IMAGE_FILES), - ('share/gramps/icons/hicolor/16x16', IMAGE_16), - ('share/gramps/icons/hicolor/22x22', IMAGE_22), - ('share/gramps/icons/hicolor/48x48', IMAGE_48), - ('share/gramps/icons/hicolor/scalable', IMAGE_SC), - ] + packages = packages, + package_data = {'gramps': package_data}, + data_files = data_files, + scripts = ['scripts/gramps'] )