kuuko pushed a commit to branch master. http://git.enlightenment.org/misc/polkit-efl.git/commit/?id=f7519f806e598361f20e233315e6a33967581ab6
commit f7519f806e598361f20e233315e6a33967581ab6 Author: Kai Huuhko <kai.huu...@gmail.com> Date: Fri Jun 20 06:57:44 2014 +0300 Modify setup.py to allow installing with the default generated tarball --- INSTALL | 2 ++ setup.py | 84 ++++++++++++++++++++++++++++++++++++---------------------------- 2 files changed, 49 insertions(+), 37 deletions(-) diff --git a/INSTALL b/INSTALL index 29fed47..7cd4104 100644 --- a/INSTALL +++ b/INSTALL @@ -20,3 +20,5 @@ Install ======= (sudo) python setup.py install + +The script is installed into $prefix/libexec diff --git a/setup.py b/setup.py index 7bacfa1..ed39fe0 100755 --- a/setup.py +++ b/setup.py @@ -4,6 +4,7 @@ from distutils.core import setup, Command from distutils.log import info, error from distutils.command.build import build from distutils.dep_util import newer +from distutils.errors import DistutilsFileError from sys import exec_prefix import os.path import subprocess @@ -30,16 +31,20 @@ class BuildThemes(Command): def compile_theme(self, theme_dir, name): edc_path = os.path.join(theme_dir, name + '.edc') edj_path = os.path.join(theme_dir, name + '.edj') - if newer(edc_path, edj_path): - info('Compiling theme "%s" from %s' % (name, edc_path)) - ret = subprocess.call([ - 'edje_cc', edc_path, - '-id', os.path.join(theme_dir, 'images'), - ]) - if ret != 0: - error('Error compiling theme "%s"' % name) - else: - shutil.copymode(edc_path, edj_path) + if os.path.exists(edc_path): + if newer(edc_path, edj_path): + info('Compiling theme "%s" from %s' % (name, edc_path)) + ret = subprocess.call([ + 'edje_cc', edc_path, + '-id', os.path.join(theme_dir, 'images'), + ]) + if ret != 0: + error('Error compiling theme "%s"' % name) + else: + shutil.copymode(edc_path, edj_path) + else: + if not os.path.exists(edj_path): + raise DistutilsFileError("Cannot build without theme files") def get_l10n_files(): @@ -66,18 +71,19 @@ class BuildL10N(Command): def run(self): for po_dir, lang, mo_path, po_path in get_l10n_files(): - if newer(po_path, mo_path): - info('Compiling l10n for "%s" from %s' % (lang, po_path)) - ret = subprocess.call([ - "msgfmt", - "-o%s" % (mo_path), - "-c", - po_path, - ]) - if ret != 0: - error('Error compiling l10n for "%s"' % (lang)) - else: - shutil.copymode(po_path, mo_path) + if os.path.exists(po_path): + if newer(po_path, mo_path): + info('Compiling l10n for "%s" from %s' % (lang, po_path)) + ret = subprocess.call([ + "msgfmt", + "-o%s" % (mo_path), + "-c", + po_path, + ]) + if ret != 0: + error('Error compiling l10n for "%s"' % (lang)) + else: + shutil.copymode(po_path, mo_path) class PrepareDesktop(Command): @@ -92,20 +98,24 @@ class PrepareDesktop(Command): def run(self): if not self.dry_run: - with open( - 'data/polkit-efl-authentication-agent-1.desktop.in', 'r' - ) as src: - tmp = src.read() - - with open( - 'data/polkit-efl-authentication-agent-1.desktop', 'w' - ) as dest: - dest.write(tmp) - dest.write( - "Exec=%s/libexec/polkit-efl-authentication-agent-1\n" % ( - exec_prefix - ) - ) + in_path = 'data/polkit-efl-authentication-agent-1.desktop.in' + out_path = 'data/polkit-efl-authentication-agent-1.desktop' + if os.path.exists(in_path): + if newer(in_path, out_path): + with open( + in_path, 'r' + ) as src: + tmp = src.read() + + with open( + out_path, 'w' + ) as dest: + dest.write(tmp) + dest.write( + "Exec=%s/libexec/polkit-efl-authentication-agent-1\n" % ( + exec_prefix + ) + ) data_files = [ @@ -143,7 +153,7 @@ class Build(build): setup( name='polkit-efl', - version='0.1', + version='0.1.0', author='Kai Huuhko', author_email='kai.huu...@gmail.com', maintainer='Kai Huuhko', --