5621: cleanup, documented classes
svn: r19041
This commit is contained in:
parent
c37ff11cfa
commit
803cf27077
@ -3,7 +3,7 @@
|
||||
#install_lib= /usr/lib/python2.6/dist-packages
|
||||
#install_data= $prefix
|
||||
#install_scripts=/usr/bin
|
||||
record = log
|
||||
#record = log
|
||||
|
||||
[dist]
|
||||
long-description = Gramps is an application...
|
||||
|
101
setup.py
101
setup.py
@ -38,6 +38,19 @@ if sys.version < '2.6':
|
||||
sys.exit('Error: Python-2.6 or newer is required. Current version:\n %s'
|
||||
% sys.version)
|
||||
|
||||
if os.name == 'nt':
|
||||
script = [os.path.join('windows','gramps.pyw')]
|
||||
elif os.name == 'darwin':
|
||||
script = [os.path.join('mac','launcher.sh')]
|
||||
else:
|
||||
# os.name == 'posix'
|
||||
script = [os.path.join('gramps.sh')]
|
||||
|
||||
if platform.system() == 'FreeBSD':
|
||||
man_dir = 'man'
|
||||
else:
|
||||
man_dir = os.path.join('share', 'man')
|
||||
|
||||
def modules_check():
|
||||
'''Check if necessary modules is installed.
|
||||
The function is executed by distutils (by the install command).'''
|
||||
@ -224,20 +237,26 @@ def os_files ():
|
||||
return files
|
||||
|
||||
|
||||
class compile_catalog():
|
||||
class CompileCatalog():
|
||||
'''
|
||||
Mixture between babel class and custom compilation
|
||||
'''
|
||||
|
||||
user_options = [('domain=gramps', 'directory=po', 'fr.po', 'fr.mo')]
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
|
||||
def run (self):
|
||||
for po in glob.glob(os.path.join(PO_DIR, '*.po')):
|
||||
lang = os.path.basename(po[:-3])
|
||||
mo = os.path.join(MO_DIR, lang, 'gramps.mo')
|
||||
directory = os.path.dirname(mo)
|
||||
if not os.path.exists(directory):
|
||||
os.makedirs(directory)
|
||||
if os.name == 'posix':
|
||||
os.system('msgfmt %s/%s.po -o %s' % (PO_DIR, lang, mo))
|
||||
print (directory)
|
||||
pass
|
||||
|
||||
def finalize_options (self):
|
||||
pass
|
||||
|
||||
def trans_files():
|
||||
'''
|
||||
List of available compiled translations; ready for installation
|
||||
'''
|
||||
translation_files = []
|
||||
for mo in glob.glob (os.path.join (MO_DIR, '*', 'gramps.mo')):
|
||||
lang = os.path.basename(os.path.dirname(mo))
|
||||
@ -250,13 +269,16 @@ def trans_files ():
|
||||
return translation_files
|
||||
|
||||
class BuildData(build):
|
||||
'''
|
||||
Custom command for 'python setup.py build' ...
|
||||
'''
|
||||
|
||||
def initialize_options (self):
|
||||
|
||||
if os.name == 'posix':
|
||||
# initial makefiles ... create launcher and generate const.py
|
||||
# see script !
|
||||
os.system('./autogen.sh')
|
||||
#os.system('./autogen.sh')
|
||||
# related translations files
|
||||
os.system('intltool-merge -d po/ data/gramps.desktop.in data/gramps.desktop')
|
||||
os.system('intltool-merge -x po/gramps.pot src/data/tips.xml.in src/data/tips.xml')
|
||||
@ -265,17 +287,29 @@ class BuildData(build):
|
||||
|
||||
def run (self):
|
||||
|
||||
# os.name == 'posix'
|
||||
# Run upgrade pre script
|
||||
# /!\ should be gramps.sh with variables
|
||||
# missing const.py (const.py.in)
|
||||
pass
|
||||
|
||||
#CompileCatalog()
|
||||
#babel.compile_catalog()
|
||||
for po in glob.glob(os.path.join(PO_DIR, '*.po')):
|
||||
lang = os.path.basename(po[:-3])
|
||||
mo = os.path.join(MO_DIR, lang, 'gramps.mo')
|
||||
directory = os.path.dirname(mo)
|
||||
if not os.path.exists(directory):
|
||||
os.makedirs(directory)
|
||||
if os.name == 'posix':
|
||||
os.system('msgfmt %s/%s.po -o %s' % (PO_DIR, lang, mo))
|
||||
print (directory)
|
||||
|
||||
def finalize_options (self):
|
||||
|
||||
compile_catalog()
|
||||
pass
|
||||
|
||||
class InstallData(install_data):
|
||||
'''
|
||||
Custom command for 'python setup.py install' ...
|
||||
'''
|
||||
|
||||
def run (self):
|
||||
|
||||
@ -298,7 +332,26 @@ class InstallData(install_data):
|
||||
|
||||
#ldconfig
|
||||
|
||||
class Install(Command):
|
||||
'''
|
||||
Standard command for 'python setup.py install' ...
|
||||
'''
|
||||
|
||||
description = "Attempt an install and generate a log file"
|
||||
|
||||
user_options = [('fake', None, 'Override')]
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
|
||||
def run (self):
|
||||
pass
|
||||
|
||||
def finalize_options (self):
|
||||
pass
|
||||
|
||||
class Uninstall(Command):
|
||||
|
||||
description = "Attempt an uninstall from an install log file"
|
||||
|
||||
user_options = [('log=', None, 'Installation record filename')]
|
||||
@ -353,22 +406,12 @@ class Uninstall(Command):
|
||||
else:
|
||||
print ("skipping empty directory %s" % repr(dir))
|
||||
|
||||
if os.name == 'nt':
|
||||
script = [os.path.join('windows','gramps.pyw')]
|
||||
elif os.name == 'darwin':
|
||||
script = [os.path.join('mac','launcher.sh')]
|
||||
else:
|
||||
script = [os.path.join('gramps.sh')]
|
||||
|
||||
if platform.system() == 'FreeBSD':
|
||||
man_dir = 'man'
|
||||
else:
|
||||
man_dir = os.path.join('share', 'man')
|
||||
|
||||
# TODO
|
||||
# implement environment/variables for
|
||||
# extract_messages, init_catalog, update_catalog classes
|
||||
# extract_messages, update_catalog classes
|
||||
# message_extractors = po/POTFILES.in
|
||||
# see also 'setup.cfg'
|
||||
|
||||
result = setup(
|
||||
name = name,
|
||||
@ -396,10 +439,10 @@ result = setup(
|
||||
requires = ['pygtk', 'pycairo', 'pygobject', 'babel'],
|
||||
cmdclass = {
|
||||
'build': BuildData,
|
||||
'install': Install,
|
||||
'install_data': InstallData,
|
||||
'uninstall': Uninstall,
|
||||
# 'compile_catalog': babel.compile_catalog,
|
||||
'compile_catalog': compile_catalog,
|
||||
'compile_catalog': babel.compile_catalog,
|
||||
'extract_messages': babel.extract_messages,
|
||||
'update_catalog': babel.update_catalog},
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user