Fix bug with --install-scripts option

svn: r21263
This commit is contained in:
Nick Hall 2013-01-31 22:30:02 +00:00
parent 11df6b2b29
commit e6a43370bd
2 changed files with 6 additions and 31 deletions

3
scripts/gramps Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env python
import gramps.grampsapp as app
app.main()

View File

@ -209,35 +209,6 @@ def merge(in_file, out_file, option, po_dir='po', cache=True):
out_file) out_file)
raise SystemExit(msg) 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): def write_const_py(command):
''' '''
Write the const.py file. Write the const.py file.
@ -309,7 +280,7 @@ class install(_install):
self.enable_packager_mode = False self.enable_packager_mode = False
def run(self): def run(self):
install_template(self) write_const_py(self)
_install.run(self) _install.run(self)
if self.enable_packager_mode: if self.enable_packager_mode:
log.warn('WARNING: Packager mode enabled. Post-installation mime ' log.warn('WARNING: Packager mode enabled. Post-installation mime '
@ -508,5 +479,6 @@ setup(name = 'gramps',
cmdclass = {'build': build, 'install': install}, cmdclass = {'build': build, 'install': install},
packages = packages, packages = packages,
package_data = {'gramps': package_data}, package_data = {'gramps': package_data},
data_files = data_files data_files = data_files,
scripts = ['scripts/gramps']
) )