diff options
author | Greg Noel <GregNoel@tigris.org> | 2010-03-25 04:14:28 (GMT) |
---|---|---|
committer | Greg Noel <GregNoel@tigris.org> | 2010-03-25 04:14:28 (GMT) |
commit | 22d352500f1cd6bd0c53d788a5dc44a1fefa676e (patch) | |
tree | 0984fd581082c27cfbfbb7f94d5751b0e6fd2741 /src/engine/SCons/Tool/packaging/rpm.py | |
parent | 75ac32ac8e32076e25b72a19eb56340cc585fa4e (diff) | |
download | SCons-22d352500f1cd6bd0c53d788a5dc44a1fefa676e.zip SCons-22d352500f1cd6bd0c53d788a5dc44a1fefa676e.tar.gz SCons-22d352500f1cd6bd0c53d788a5dc44a1fefa676e.tar.bz2 |
Move 2.0 changes collected in branches/pending back to trunk for further
development. Note that this set of changes is NOT backward-compatible;
the trunk no longer works with Python 1.5.2, 2.0, or 2.1.
Diffstat (limited to 'src/engine/SCons/Tool/packaging/rpm.py')
-rw-r--r-- | src/engine/SCons/Tool/packaging/rpm.py | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/engine/SCons/Tool/packaging/rpm.py b/src/engine/SCons/Tool/packaging/rpm.py index c2a532c..7480542 100644 --- a/src/engine/SCons/Tool/packaging/rpm.py +++ b/src/engine/SCons/Tool/packaging/rpm.py @@ -25,11 +25,11 @@ The rpm packager. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # +from __future__ import generators ### KEEP FOR COMPATIBILITY FIXERS __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os -import string import SCons.Builder @@ -65,7 +65,7 @@ def package(env, target, source, PACKAGEROOT, NAME, VERSION, buildarchitecture = os.uname()[4] buildarchitecture = archmap.get(buildarchitecture, buildarchitecture) - if kw.has_key('ARCHITECTURE'): + if 'ARCHITECTURE' in kw: buildarchitecture = kw['ARCHITECTURE'] fmt = '%s-%s-%s.%s.rpm' @@ -81,9 +81,9 @@ def package(env, target, source, PACKAGEROOT, NAME, VERSION, del kw['source'], kw['target'], kw['env'] # if no "SOURCE_URL" tag is given add a default one. - if not kw.has_key('SOURCE_URL'): + if 'SOURCE_URL' not in kw: #kw['SOURCE_URL']=(str(target[0])+".tar.gz").replace('.rpm', '') - kw['SOURCE_URL']=string.replace(str(target[0])+".tar.gz", '.rpm', '') + kw['SOURCE_URL']=(str(target[0])+".tar.gz").replace('.rpm', '') # mangle the source and target list for the rpmbuild env = OverrideEnvironment(env, kw) @@ -92,7 +92,7 @@ def package(env, target, source, PACKAGEROOT, NAME, VERSION, target, source = collectintargz(target, source, env) # now call the rpm builder to actually build the packet. - return apply(bld, [env, target, source], kw) + return bld(env, target, source, **kw) def collectintargz(target, source, env): """ Puts all source files into a tar.gz file. """ @@ -102,21 +102,21 @@ def collectintargz(target, source, env): # filter out the target we are building the source list for. #sources = [s for s in sources if not (s in target)] - sources = filter(lambda s, t=target: not (s in t), sources) + sources = [s for s in sources if s not in target] # find the .spec file for rpm and add it since it is not necessarily found # by the FindSourceFiles function. #sources.extend( [s for s in source if str(s).rfind('.spec')!=-1] ) - spec_file = lambda s: string.rfind(str(s), '.spec') != -1 - sources.extend( filter(spec_file, source) ) + spec_file = lambda s: str(s).rfind('.spec') != -1 + sources.extend( list(filter(spec_file, source)) ) # as the source contains the url of the source package this rpm package # is built from, we extract the target name #tarball = (str(target[0])+".tar.gz").replace('.rpm', '') - tarball = string.replace(str(target[0])+".tar.gz", '.rpm', '') + tarball = (str(target[0])+".tar.gz").replace('.rpm', '') try: #tarball = env['SOURCE_URL'].split('/')[-1] - tarball = string.split(env['SOURCE_URL'], '/')[-1] + tarball = env['SOURCE_URL'].split('/')[-1] except KeyError, e: raise SCons.Errors.UserError( "Missing PackageTag '%s' for RPM packager" % e.args[0] ) @@ -150,7 +150,7 @@ def build_specfile(target, source, env): file.close() # call a user specified function - if env.has_key('CHANGE_SPECFILE'): + if 'CHANGE_SPECFILE' in env: env['CHANGE_SPECFILE'](target, source) except KeyError, e: @@ -188,16 +188,16 @@ def build_specfile_sections(spec): # Default prep, build, install and clean rules # TODO: optimize those build steps, to not compile the project a second time - if not spec.has_key('X_RPM_PREP'): + if 'X_RPM_PREP' not in spec: spec['X_RPM_PREP'] = '[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"' + '\n%setup -q' - if not spec.has_key('X_RPM_BUILD'): + if 'X_RPM_BUILD' not in spec: spec['X_RPM_BUILD'] = 'mkdir "$RPM_BUILD_ROOT"' - if not spec.has_key('X_RPM_INSTALL'): + if 'X_RPM_INSTALL' not in spec: spec['X_RPM_INSTALL'] = 'scons --install-sandbox="$RPM_BUILD_ROOT" "$RPM_BUILD_ROOT"' - if not spec.has_key('X_RPM_CLEAN'): + if 'X_RPM_CLEAN' not in spec: spec['X_RPM_CLEAN'] = '[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"' str = str + SimpleTagCompiler(optional_sections, mandatory=0).compile( spec ) @@ -254,7 +254,7 @@ def build_specfile_header(spec): # if not s.has_key('x_rpm_BuildRequires'): # s['x_rpm_BuildRequires'] = 'scons' - if not spec.has_key('X_RPM_BUILDROOT'): + if 'X_RPM_BUILDROOT' not in spec: spec['X_RPM_BUILDROOT'] = '%{_tmppath}/%{name}-%{version}-%{release}' str = str + SimpleTagCompiler(optional_header_fields, mandatory=0).compile( spec ) @@ -268,7 +268,7 @@ def build_specfile_filesection(spec, files): """ str = '%files\n' - if not spec.has_key('X_RPM_DEFATTR'): + if 'X_RPM_DEFATTR' not in spec: spec['X_RPM_DEFATTR'] = '(-,root,root)' str = str + '%%defattr %s\n' % spec['X_RPM_DEFATTR'] @@ -337,7 +337,7 @@ class SimpleTagCompiler: str = "" #domestic = [ (k,v) for k,v in replacements if not is_international(k) ] - domestic = filter(lambda t, i=is_international: not i(t[0]), replacements) + domestic = [t for t in replacements if not is_international(t[0])] for key, replacement in domestic: try: str = str + replacement % values[key] @@ -346,12 +346,12 @@ class SimpleTagCompiler: raise e #international = [ (k,v) for k,v in replacements if is_international(k) ] - international = filter(lambda t, i=is_international: i(t[0]), replacements) + international = [t for t in replacements if is_international(t[0])] for key, replacement in international: try: #int_values_for_key = [ (get_country_code(k),v) for k,v in values.items() if strip_country_code(k) == key ] - x = filter(lambda t,key=key,s=strip_country_code: s(t[0]) == key, values.items()) - int_values_for_key = map(lambda t,g=get_country_code: (g(t[0]),t[1]), x) + x = [t for t in values.items() if strip_country_code(t[0]) == key] + int_values_for_key = [(get_country_code(t[0]),t[1]) for t in x] for v in int_values_for_key: str = str + replacement % v except KeyError, e: |