changeset 5158:118e00ad86bd

librestrict: use misc.librestrict () rather than os.environ.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Mon, 16 Feb 2009 16:16:10 +0100
parents 8389d7083f05
children ab0dccc775b4
files gub/misc.py gub/specs/fontconfig.py gub/specs/freetype.py gub/specs/glib.py gub/specs/guile.py gub/specs/librestrict.py gub/specs/make.py gub/specs/nsis.py gub/specs/python.py
diffstat 9 files changed, 19 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/gub/misc.py	Mon Feb 16 16:08:14 2009 +0100
+++ b/gub/misc.py	Mon Feb 16 16:16:10 2009 +0100
@@ -622,6 +622,10 @@
          to_name=python_config)
     self.chmod (python_config, octal.o755)
 
+def librestrict ():
+    return list (sorted (os.environ.get ('LIBRESTRICT',
+                                         'open').replace (':', ' ').split (' ')))
+
 def test ():
     printf (forall (x for x in [1, 1]))
     printf (dissect_url ('git://anongit.freedesktop.org/git/fontconfig?revision=1234'))
--- a/gub/specs/fontconfig.py	Mon Feb 16 16:08:14 2009 +0100
+++ b/gub/specs/fontconfig.py	Mon Feb 16 16:16:10 2009 +0100
@@ -1,6 +1,3 @@
-import os
-#
-from gub import build
 from gub import context
 from gub import logging
 from gub import misc
@@ -83,7 +80,7 @@
         cflags = '-I%(srcdir)s -I%(srcdir)s/src %(freetype_cflags)s' 
         libs = '%(freetype_libs)s'
         relax = ''
-        if 'stat' in os.environ.get ('LIBRESTRICT', ''):
+        if 'stat' in misc.librestrict ():
             relax = 'LIBRESTRICT_IGNORE=%(tools_prefix)s/bin/make '
         for i in ('fc-case', 'fc-lang', 'fc-glyphname', 'fc-arch'):
             self.system ('''
--- a/gub/specs/freetype.py	Mon Feb 16 16:08:14 2009 +0100
+++ b/gub/specs/freetype.py	Mon Feb 16 16:16:10 2009 +0100
@@ -1,6 +1,4 @@
-import os
-#
-from gub import build
+from gub import misc
 from gub import target
 from gub import tools
 
@@ -18,7 +16,7 @@
         # Freetype stats /sbin, /usr/sbin and /hurd to determine if
         # build system is unix??
         # target.append_target_dict (self, {'LIBRESTRICT_ALLOW': '/sbin:/usr/sbin:/hurd'})
-        if 'stat' in os.environ.get ('LIBRESTRICT', ''):
+        if 'stat' in misc.librestrict ():
             target.add_target_dict (self, {'LIBRESTRICT_ALLOW': '/usr/lib/gcc:/usr/libexec/gcc:/sbin:/usr/sbin:/hurd'})
     def license_files (self):
         return ['%(srcdir)s/docs/LICENSE.TXT']
--- a/gub/specs/glib.py	Mon Feb 16 16:08:14 2009 +0100
+++ b/gub/specs/glib.py	Mon Feb 16 16:16:10 2009 +0100
@@ -1,5 +1,4 @@
-import os
-#
+from gub import misc
 from gub import tools
 from gub import target
 from gub import w32
@@ -9,7 +8,7 @@
     source = 'http://ftp.gnome.org/pub/GNOME/platform/2.22/2.22.0/sources/glib-2.16.1.tar.bz2'
     source = 'http://ftp.gnome.org/pub/GNOME/platform/2.25/2.25.5/sources/glib-2.19.5.tar.gz'
     def _get_build_dependencies (self):
-        if 'stat' in os.environ.get ('LIBRESTRICT', ''):
+        if 'stat' in misc.librestrict ():
             return ['tools::glib', 'gettext-devel', 'libtool']
         return ['gettext-devel', 'libtool']
     def config_cache_overrides (self, str):
--- a/gub/specs/guile.py	Mon Feb 16 16:08:14 2009 +0100
+++ b/gub/specs/guile.py	Mon Feb 16 16:16:10 2009 +0100
@@ -36,7 +36,7 @@
         # Guile [doc] does not compile with dash *and* not with
         # librestrict-stat.so; patch out.
         target.AutoBuild.patch (self)
-        if 'stat' in os.environ.get ('LIBRESTRICT', ''):
+        if 'stat' in misc.librestrict ():
             self.file_sub ([(' doc ', ' ')], '%(srcdir)s/Makefile.am')
     def autogen_sh (self):
         self.file_sub ([(r'AC_CONFIG_SUBDIRS\(guile-readline\)', '')],
@@ -120,14 +120,14 @@
         return (Guile.makeflags (self)
                 + ''' 'LIBTOOL=%(tools_prefix)s/bin/dash $(top_builddir)/libtool' ''')
     def _get_build_dependencies (self):
-        if 'stat' in os.environ.get ('LIBRESTRICT', ''):
+        if 'stat' in misc.librestrict ():
             return (Guile._get_build_dependencies (self)
                     + ['tools::dash', 'tools::coreutils']
                     + ['regex-devel'])
         return Guile._get_build_dependencies (self) +  ['regex-devel']
     def configure_command (self):
         SHELL = ''
-        if 'stat' in os.environ.get ('LIBRESTRICT', ''):
+        if 'stat' in misc.librestrict ():
             SHELL = ' SHELL=%(tools_prefix)s/bin/dash'
         return (Guile.configure_command (self)
                 + SHELL
@@ -291,7 +291,7 @@
         # Guile [doc] does not compile with dash *and* not with
         # librestrict-stat.so; patch out.
         tools.AutoBuild.patch (self)
-        if 'stat' in os.environ.get ('LIBRESTRICT', ''):
+        if 'stat' in misc.librestrict ():
             self.file_sub ([(' doc ', ' ')], '%(srcdir)s/Makefile.am')
     def configure_command (self):
         # FIXME: when configuring, guile runs binaries linked against
--- a/gub/specs/librestrict.py	Mon Feb 16 16:08:14 2009 +0100
+++ b/gub/specs/librestrict.py	Mon Feb 16 16:16:10 2009 +0100
@@ -1,13 +1,10 @@
-import os
-#
 from gub import tools
 from gub import misc
 
 class Librestrict_make__tools (tools.MakeBuild):
     source = 'url://host/librestrict-1.9a.tar.gz'
     def librestrict_flavours (self):
-        return list (sorted (os.environ.get ('LIBRESTRICT',
-                                             'open').replace (':', ' ').split (' ')))
+        return misc.librestrict ()
     def flavours (self):
         return ['exec', 'open', 'stat']
     def BARFS_WITH_2_5_1_name (self):
--- a/gub/specs/make.py	Mon Feb 16 16:08:14 2009 +0100
+++ b/gub/specs/make.py	Mon Feb 16 16:16:10 2009 +0100
@@ -1,5 +1,4 @@
-import os
-#
+from gub import misc
 from gub import tools
 
 class Make_make__tools (tools.AutoBuild):
@@ -12,11 +11,8 @@
         self.file_sub ([('"/usr', '"%(system_prefix)s')], '%(srcdir)s/read.c')
         self.file_sub ([('"/usr', '"%(system_prefix)s'),
                         ('"/lib', '"%(system_root)s/lib')], '%(srcdir)s/remake.c')
-    def librestrict_flavours (self):
-        return list (sorted (os.environ.get ('LIBRESTRICT',
-                                             'open').replace (':', ' ').split (' ')))
     def librestrict_name (self):
-        return 'librestrict-' + '-'.join (self.librestrict_flavours ())
+        return 'librestrict-' + '-'.join (misc.librestrict ())
     def _get_build_dependencies (self):
         #return [self.librestrict_name ()]
         return ['librestrict']
--- a/gub/specs/nsis.py	Mon Feb 16 16:08:14 2009 +0100
+++ b/gub/specs/nsis.py	Mon Feb 16 16:16:10 2009 +0100
@@ -47,7 +47,7 @@
                        '%(srcdir)s/SConstruct')
     def compile_command (self):
         relax = ''
-        if 'stat' in os.environ.get ('LIBRESTRICT', ''):
+        if 'stat' in misc.librestrict ():
             relax = 'LIBRESTRICT_IGNORE=%(tools_prefix)s/bin/python '
         return (relax
                 + tools.SConsBuild.compile_command (self)
--- a/gub/specs/python.py	Mon Feb 16 16:08:14 2009 +0100
+++ b/gub/specs/python.py	Mon Feb 16 16:16:10 2009 +0100
@@ -1,6 +1,4 @@
-import os
 import re
-import sys
 #
 from gub import build
 from gub import context
@@ -57,7 +55,7 @@
 ''')
     def install_command (self):
         relax = ''
-        if 'stat' in os.environ.get ('LIBRESTRICT', ''):
+        if 'stat' in misc.librestrict ():
             relax = 'LIBRESTRICT_ALLOW=/usr/lib/python2.4/lib-dynload:$LIBRESTRICT_ALLOW '
         return (relax
                 + target.AutoBuild.install_command (self))
@@ -148,7 +146,7 @@
         return Python.makeflags (self)
     def install_command (self):
         relax = ''
-        if 'stat' in os.environ.get ('LIBRESTRICT', ''):
+        if 'stat' in misc.librestrict ():
             relax = 'LIBRESTRICT_ALLOW=/usr/lib/python2.4/lib-dynload:$LIBRESTRICT_ALLOW '
         return (relax
                 + tools.AutoBuild.install_command (self))