Python3 changes

svn: r20673
This commit is contained in:
Gary Burton 2012-11-17 16:44:45 +00:00
parent b2d7d5c0b4
commit a760b74252

View File

@ -42,7 +42,7 @@ from distutils.command.install import install as _install
import os import os
import glob import glob
import codecs import codecs
import commands import subprocess
from stat import ST_MODE from stat import ST_MODE
VERSION = '4.0.0' VERSION = '4.0.0'
@ -56,7 +56,7 @@ def intltool_version():
Return the version of intltool as a tuple. Return the version of intltool as a tuple.
''' '''
cmd = 'intltool-update --version | head -1 | cut -d" " -f3' cmd = 'intltool-update --version | head -1 | cut -d" " -f3'
retcode, version_str = commands.getstatusoutput(cmd) retcode, version_str = subprocess.getstatusoutput(cmd)
if retcode != 0: if retcode != 0:
return None return None
else: else:
@ -113,7 +113,7 @@ def build_man(build_cmd):
os.makedirs(newdir) os.makedirs(newdir)
newfile = os.path.join(newdir, 'gramps.1') newfile = os.path.join(newdir, 'gramps.1')
subst_vars = ((u'@VERSION@', VERSION), ) subst_vars = (('@VERSION@', VERSION), )
substitute_variables(filename, newfile, subst_vars) substitute_variables(filename, newfile, subst_vars)
import gzip import gzip
@ -215,7 +215,7 @@ def write_gramps_script(install_cmd, build_scripts):
if os.name == 'posix': if os.name == 'posix':
# set read and execute bits # set read and execute bits
mode = ((os.stat(filename)[ST_MODE]) | 0555) & 07777 mode = ((os.stat(filename).st_mode) | 0o555) & 0o7777
log.info('changing mode of %s to %o', filename, mode) log.info('changing mode of %s to %o', filename, mode)
os.chmod(filename, mode) os.chmod(filename, mode)
@ -234,9 +234,9 @@ def write_const_py(install_cmd):
prefix = 'os.path.join(os.path.dirname(__file__), os.pardir)' prefix = 'os.path.join(os.path.dirname(__file__), os.pardir)'
sysconfdir = prefix + ' + "' + os.sep + 'etc"' # Is this correct? sysconfdir = prefix + ' + "' + os.sep + 'etc"' # Is this correct?
subst_vars = ((u'@VERSIONSTRING@', VERSION), subst_vars = (('@VERSIONSTRING@', VERSION),
(u'"@prefix@"', prefix), ('"@prefix@"', prefix),
(u'"@sysconfdir@"', sysconfdir)) ('"@sysconfdir@"', sysconfdir))
substitute_variables(const_py_in, const_py, subst_vars) substitute_variables(const_py_in, const_py, subst_vars)
@ -329,7 +329,7 @@ for (dirpath, dirnames, filenames) in os.walk(basedir):
data_list.append(dirpath[7:] + '/' + dirname + '/*.js') data_list.append(dirpath[7:] + '/' + dirname + '/*.js')
data_list.append('plugins/webstuff/images/*.gif') data_list.append('plugins/webstuff/images/*.gif')
data_list.append('plugins/webstuff/images/*.ico') data_list.append('plugins/webstuff/images/*.ico')
print data_list print(data_list)
setup(name = 'gramps', setup(name = 'gramps',
description = ('Gramps (Genealogical Research and Analysis Management ' description = ('Gramps (Genealogical Research and Analysis Management '