summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-09-26 08:02:27 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-09-26 08:03:03 -0700
commit860ad99d5ac781d1277c0c4e90735e5e3dadd4d7 (patch)
tree10bff8014dae3e1b92df2f8ce6f2a8ea4c5ccfa3
parent20f0c059b4ceef520a0bd8580960a9d2f4fceb88 (diff)
downloadattobuild-860ad99d5ac781d1277c0c4e90735e5e3dadd4d7.tar.gz
attobuild-860ad99d5ac781d1277c0c4e90735e5e3dadd4d7.tar.bz2
attobuild-860ad99d5ac781d1277c0c4e90735e5e3dadd4d7.tar.xz
attobuild-860ad99d5ac781d1277c0c4e90735e5e3dadd4d7.zip
Remove support for origin tracking
This has not been very useful since config.status was implemented, and it kind of complicates the code.
-rw-r--r--attoconf/_version.py2
-rw-r--r--attoconf/core.py9
-rw-r--r--attoconf/lib/arches.py12
-rw-r--r--attoconf/lib/c.py64
-rw-r--r--attoconf/lib/config_hash.py5
-rw-r--r--attoconf/lib/install.py124
-rw-r--r--attoconf/lib/make.py6
-rw-r--r--attoconf/lib/templates.py5
8 files changed, 91 insertions, 136 deletions
diff --git a/attoconf/_version.py b/attoconf/_version.py
index 943af03..dd1465e 100644
--- a/attoconf/_version.py
+++ b/attoconf/_version.py
@@ -11,7 +11,7 @@ minor = 8
# Incremented if there is a bugfix release.
# Might not be contiguous.
-patch = 0
+patch = 1
# Reserved for distributors and forks.
# Contains arbitrary text, but no parentheses or newlines.
diff --git a/attoconf/core.py b/attoconf/core.py
index 7c6444b..b5cb008 100644
--- a/attoconf/core.py
+++ b/attoconf/core.py
@@ -110,7 +110,7 @@ class Project(object):
if check is not None:
self.order.append(var)
self.checks.append(
- lambda bld: check(bld, **{help_var: bld.vars[var][0]}))
+ lambda bld: check(bld, **{help_var: bld.vars[var]}))
if help_var is None:
help_var = var
@@ -153,7 +153,7 @@ class Build(object):
'''
self.project = project
self.builddir = trim_trailing_slashes(builddir)
- self.vars = {o.var: (o.init, 'default')
+ self.vars = {o.var: o.init
for o in project.options.itervalues()
if o.var is not None}
self._seen_args = OrderedDict()
@@ -184,7 +184,7 @@ class Build(object):
opt = self.project.options.get(k)
if opt is None:
raise sys.exit('Unknown option %s' % k)
- self.vars[opt.var] = (opt.type(a), 'command-line')
+ self.vars[opt.var] = opt.type(a)
def finish(self):
''' With the current set of variables, run all the checks
@@ -216,8 +216,9 @@ class Build(object):
continue
val = env.get(k)
if val is not None:
+ self._seen_args[k] = val
opt = self.project.options[k]
- self.vars[opt.var] = (opt.type(val), 'environment')
+ self.vars[opt.var] = opt.type(val)
for arg in args:
self.apply_arg(arg)
diff --git a/attoconf/lib/arches.py b/attoconf/lib/arches.py
index f2172b9..cffd8ca 100644
--- a/attoconf/lib/arches.py
+++ b/attoconf/lib/arches.py
@@ -28,17 +28,13 @@ def build(build, BUILD):
def host(build, HOST):
if HOST is None:
- BUILD, origin = build.vars['BUILD']
- if origin != 'default':
- origin = 'derived'
- build.vars['HOST'] = (BUILD, origin)
+ BUILD = build.vars['BUILD']
+ build.vars['HOST'] = BUILD
def target(build, TARGET):
if TARGET is None:
- HOST, origin = build.vars['HOST']
- if origin != 'default':
- origin = 'derived'
- build.vars['TARGET'] = (HOST, origin)
+ HOST = build.vars['HOST']
+ build.vars['TARGET'] = HOST
class Arches2(ClassyProject):
__slots__ = ()
diff --git a/attoconf/lib/c.py b/attoconf/lib/c.py
index 13dd3c1..062e695 100644
--- a/attoconf/lib/c.py
+++ b/attoconf/lib/c.py
@@ -62,9 +62,9 @@ class TempFile:
def try_compile_c(build, body, CFLAGS=[], CPPFLAGS=[]):
- CC = build.vars['CC'][0]
- CFLAGS = build.vars['CFLAGS'][0] + CFLAGS
- CPPFLAGS = build.vars['CPPFLAGS'][0] + CPPFLAGS
+ CC = build.vars['CC']
+ CFLAGS = build.vars['CFLAGS'] + CFLAGS
+ CPPFLAGS = build.vars['CPPFLAGS'] + CPPFLAGS
in_ = 'atto-test.c'
ins = [in_]
out = 'atto-test.o'
@@ -76,11 +76,11 @@ def try_compile_c(build, body, CFLAGS=[], CPPFLAGS=[]):
raise TestError(error)
def try_compile_link_c(build, body, CFLAGS=[], CPPFLAGS=[], LDFLAGS=[], LDLIBS=[]):
- CC = build.vars['CC'][0]
- CFLAGS = build.vars['CFLAGS'][0] + CFLAGS
- CPPFLAGS = build.vars['CPPFLAGS'][0] + CPPFLAGS
- LDFLAGS = build.vars['LDFLAGS'][0] + LDFLAGS
- LDLIBS = build.vars['LDLIBS'][0] + LDLIBS
+ CC = build.vars['CC']
+ CFLAGS = build.vars['CFLAGS'] + CFLAGS
+ CPPFLAGS = build.vars['CPPFLAGS'] + CPPFLAGS
+ LDFLAGS = build.vars['LDFLAGS'] + LDFLAGS
+ LDLIBS = build.vars['LDLIBS'] + LDLIBS
in_ = 'atto-test.c'
ins = [in_]
out = 'atto-test'
@@ -92,9 +92,9 @@ def try_compile_link_c(build, body, CFLAGS=[], CPPFLAGS=[], LDFLAGS=[], LDLIBS=[
raise TestError(error)
def try_compile_cxx(build, body, CXXFLAGS=[], CPPFLAGS=[]):
- CXX = build.vars['CXX'][0]
- CXXFLAGS = build.vars['CXXFLAGS'][0] + CXXFLAGS
- CPPFLAGS = build.vars['CPPFLAGS'][0] + CPPFLAGS
+ CXX = build.vars['CXX']
+ CXXFLAGS = build.vars['CXXFLAGS'] + CXXFLAGS
+ CPPFLAGS = build.vars['CPPFLAGS'] + CPPFLAGS
in_ = 'atto-test.cxx'
out = 'atto-test.o'
@@ -105,11 +105,11 @@ def try_compile_cxx(build, body, CXXFLAGS=[], CPPFLAGS=[]):
raise TestError(error)
def try_compile_link_cxx(build, body, CXXFLAGS=[], CPPFLAGS=[], LDFLAGS=[], LDLIBS=[]):
- CXX = build.vars['CXX'][0]
- CXXFLAGS = build.vars['CXXFLAGS'][0] + CXXFLAGS
- CPPFLAGS = build.vars['CPPFLAGS'][0] + CPPFLAGS
- LDFLAGS = build.vars['LDFLAGS'][0] + LDFLAGS
- LDLIBS = build.vars['LDLIBS'][0] + LDLIBS
+ CXX = build.vars['CXX']
+ CXXFLAGS = build.vars['CXXFLAGS'] + CXXFLAGS
+ CPPFLAGS = build.vars['CPPFLAGS'] + CPPFLAGS
+ LDFLAGS = build.vars['LDFLAGS'] + LDFLAGS
+ LDLIBS = build.vars['LDLIBS'] + LDLIBS
in_ = 'atto-test.cxx'
ins = [in_]
out = 'atto-test'
@@ -122,9 +122,9 @@ def try_compile_link_cxx(build, body, CXXFLAGS=[], CPPFLAGS=[], LDFLAGS=[], LDLI
if 0:
def try_linkonly_c(build, ins, LDFLAGS=[], LDLIBS=[]):
- CC = build.vars['CC'][0]
- LDFLAGS = build.vars['LDFLAGS'][0] + LDFLAGS
- LDLIBS = build.vars['LDLIBS'][0] + LDLIBS
+ CC = build.vars['CC']
+ LDFLAGS = build.vars['LDFLAGS'] + LDFLAGS
+ LDLIBS = build.vars['LDLIBS'] + LDLIBS
out = 'atto-test'
args = CC + LDFLAGS + ins + LDLIBS + ['-o', out]
@@ -134,11 +134,11 @@ if 0:
raise TestError(error)
def try_compile_link2_c(build, body, CFLAGS=[], CPPFLAGS=[], LDFLAGS=[], LDLIBS=[]):
- CC = build.vars['CC'][0]
- CFLAGS = build.vars['CFLAGS'][0] + CFLAGS
- CPPFLAGS = build.vars['CPPFLAGS'][0] + CPPFLAGS
- LDFLAGS = build.vars['LDFLAGS'][0] + LDFLAGS
- LDLIBS = build.vars['LDLIBS'][0] + LDLIBS
+ CC = build.vars['CC']
+ CFLAGS = build.vars['CFLAGS'] + CFLAGS
+ CPPFLAGS = build.vars['CPPFLAGS'] + CPPFLAGS
+ LDFLAGS = build.vars['LDFLAGS'] + LDFLAGS
+ LDLIBS = build.vars['LDLIBS'] + LDLIBS
in_ = 'atto-test.c'
ins = [in_]
mid = 'atto-test.o'
@@ -160,9 +160,9 @@ def try_compile_link2_c(build, body, CFLAGS=[], CPPFLAGS=[], LDFLAGS=[], LDLIBS=
if 0:
def try_linkonly_cxx(build, ins, LDFLAGS=[], LDLIBS=[]):
- CXX = build.vars['CXX'][0]
- LDFLAGS = build.vars['LDFLAGS'][0] + LDFLAGS
- LDLIBS = build.vars['LDLIBS'][0] + LDLIBS
+ CXX = build.vars['CXX']
+ LDFLAGS = build.vars['LDFLAGS'] + LDFLAGS
+ LDLIBS = build.vars['LDLIBS'] + LDLIBS
out = 'atto-test'
args = CXX + LDFLAGS + ins + LDLIBS + ['-o', out]
@@ -172,11 +172,11 @@ if 0:
raise TestError(error)
def try_compile_link2_cxx(build, body, CXXFLAGS=[], CPPFLAGS=[], LDFLAGS=[], LDLIBS=[]):
- CXX = build.vars['CXX'][0]
- CXXFLAGS = build.vars['CXXFLAGS'][0] + CXXFLAGS
- CPPFLAGS = build.vars['CPPFLAGS'][0] + CPPFLAGS
- LDFLAGS = build.vars['LDFLAGS'][0] + LDFLAGS
- LDLIBS = build.vars['LDLIBS'][0] + LDLIBS
+ CXX = build.vars['CXX']
+ CXXFLAGS = build.vars['CXXFLAGS'] + CXXFLAGS
+ CPPFLAGS = build.vars['CPPFLAGS'] + CPPFLAGS
+ LDFLAGS = build.vars['LDFLAGS'] + LDFLAGS
+ LDLIBS = build.vars['LDLIBS'] + LDLIBS
in_ = 'atto-test.cxx'
ins = [in_]
mid = 'atto-test.o'
diff --git a/attoconf/lib/config_hash.py b/attoconf/lib/config_hash.py
index 42cdf21..81d4a68 100644
--- a/attoconf/lib/config_hash.py
+++ b/attoconf/lib/config_hash.py
@@ -25,15 +25,14 @@ from ..classy import ClassyProject
def calc_hash(build):
hash = md5()
- for var, (val, origin), in sorted(build.vars.iteritems()):
- # origin is not included in the hash
+ for var, val in sorted(build.vars.iteritems()):
hash.update('%s = %s\n' % (var, val))
return hash.hexdigest()
def add_config_hash(build):
print('Generating a hash of config options ...')
- build.vars['CONFIG_HASH'] = (calc_hash(build), 'special')
+ build.vars['CONFIG_HASH'] = calc_hash(build)
class ConfigHash(ClassyProject):
diff --git a/attoconf/lib/install.py b/attoconf/lib/install.py
index 85e0de5..b3eb989 100644
--- a/attoconf/lib/install.py
+++ b/attoconf/lib/install.py
@@ -34,148 +34,108 @@ def prefix(build, PREFIX):
def exec_prefix(build, EPREFIX):
if EPREFIX is None:
- PREFIX, origin = build.vars['PREFIX']
- if origin != 'default':
- origin = 'derived'
- build.vars['EPREFIX'] = (PREFIX, origin)
+ PREFIX = build.vars['PREFIX']
+ build.vars['EPREFIX'] = PREFIX
def bindir(build, DIR):
if DIR is None:
- EPREFIX, origin = build.vars['EPREFIX']
- if origin != 'default':
- origin = 'derived'
- build.vars['BINDIR'] = (os.path.join(EPREFIX, 'bin'), origin)
+ EPREFIX = build.vars['EPREFIX']
+ build.vars['BINDIR'] = os.path.join(EPREFIX, 'bin')
def sbindir(build, DIR):
if DIR is None:
- EPREFIX, origin = build.vars['EPREFIX']
- if origin != 'default':
- origin = 'derived'
- build.vars['SBINDIR'] = (os.path.join(EPREFIX, 'sbin'), origin)
+ EPREFIX = build.vars['EPREFIX']
+ build.vars['SBINDIR'] = os.path.join(EPREFIX, 'sbin')
def libexecdir(build, DIR):
if DIR is None:
- EPREFIX, origin = build.vars['EPREFIX']
- if origin != 'default':
- origin = 'derived'
- build.vars['LIBEXECDIR'] = (os.path.join(EPREFIX, 'libexec'), origin)
+ EPREFIX = build.vars['EPREFIX']
+ build.vars['LIBEXECDIR'] = os.path.join(EPREFIX, 'libexec')
def sysconfdir(build, DIR):
if DIR is None:
- PREFIX, origin = build.vars['PREFIX']
- if origin != 'default':
- origin = 'derived'
- build.vars['SYSCONFDIR'] = (os.path.join(PREFIX, 'etc'), origin)
+ PREFIX = build.vars['PREFIX']
+ build.vars['SYSCONFDIR'] = os.path.join(PREFIX, 'etc')
def sharedstatedir(build, DIR):
if DIR is None:
- PREFIX, origin = build.vars['PREFIX']
- if origin != 'default':
- origin = 'derived'
- build.vars['SHAREDSTATEDIR'] = (os.path.join(PREFIX, 'com'), origin)
+ PREFIX = build.vars['PREFIX']
+ build.vars['SHAREDSTATEDIR'] = os.path.join(PREFIX, 'com')
def localstatedir(build, DIR):
if DIR is None:
- PREFIX, origin = build.vars['PREFIX']
- if origin != 'default':
- origin = 'derived'
- build.vars['LOCALSTATEDIR'] = (os.path.join(PREFIX, 'var'), origin)
+ PREFIX = build.vars['PREFIX']
+ build.vars['LOCALSTATEDIR'] = os.path.join(PREFIX, 'var')
def libdir(build, DIR):
if DIR is None:
- EPREFIX, origin = build.vars['EPREFIX']
- if origin != 'default':
- origin = 'derived'
- build.vars['LIBDIR'] = (os.path.join(EPREFIX, 'lib'), origin)
+ EPREFIX = build.vars['EPREFIX']
+ build.vars['LIBDIR'] = os.path.join(EPREFIX, 'lib')
def includedir(build, DIR):
if DIR is None:
- PREFIX, origin = build.vars['PREFIX']
- if origin != 'default':
- origin = 'derived'
- build.vars['INCLUDEDIR'] = (os.path.join(PREFIX, 'include'), origin)
+ PREFIX = build.vars['PREFIX']
+ build.vars['INCLUDEDIR'] = os.path.join(PREFIX, 'include')
def oldincludedir(build, DIR):
pass
def datarootdir(build, DIR):
if DIR is None:
- PREFIX, origin = build.vars['PREFIX']
- if origin != 'default':
- origin = 'derived'
- build.vars['DATAROOTDIR'] = (os.path.join(PREFIX, 'share'), origin)
+ PREFIX = build.vars['PREFIX']
+ build.vars['DATAROOTDIR'] = os.path.join(PREFIX, 'share')
def datadir(build, DIR):
if DIR is None:
- DATAROOTDIR, origin = build.vars['DATAROOTDIR']
- if origin != 'default':
- origin = 'derived'
- build.vars['DATADIR'] = (DATAROOTDIR, origin)
+ DATAROOTDIR = build.vars['DATAROOTDIR']
+ build.vars['DATADIR'] = DATAROOTDIR
def packagedatadir(build, DIR):
if DIR is None:
- DATADIR, origin = build.vars['DATADIR']
- PACKAGE, prigin = build.vars['PACKAGE']
- if origin != 'default' or prigin != 'default':
- origin = 'derived'
- build.vars['PACKAGEDATADIR'] = (os.path.join(DATADIR, PACKAGE), origin)
+ DATADIR = build.vars['DATADIR']
+ PACKAGE = build.vars['PACKAGE']
+ build.vars['PACKAGEDATADIR'] = os.path.join(DATADIR, PACKAGE)
def infodir(build, DIR):
if DIR is None:
- DATAROOTDIR, origin = build.vars['DATAROOTDIR']
- if origin != 'default':
- origin = 'derived'
- build.vars['INFODIR'] = (os.path.join(DATAROOTDIR, 'info'), origin)
+ DATAROOTDIR = build.vars['DATAROOTDIR']
+ build.vars['INFODIR'] = os.path.join(DATAROOTDIR, 'info')
def localedir(build, DIR):
if DIR is None:
- DATAROOTDIR, origin = build.vars['DATAROOTDIR']
- if origin != 'default':
- origin = 'derived'
- build.vars['LOCALEDIR'] = (os.path.join(DATAROOTDIR, 'locale'), origin)
+ DATAROOTDIR = build.vars['DATAROOTDIR']
+ build.vars['LOCALEDIR'] = os.path.join(DATAROOTDIR, 'locale')
def mandir(build, DIR):
if DIR is None:
- DATAROOTDIR, origin = build.vars['DATAROOTDIR']
- if origin != 'default':
- origin = 'derived'
- build.vars['MANDIR'] = (os.path.join(DATAROOTDIR, 'man'), origin)
+ DATAROOTDIR = build.vars['DATAROOTDIR']
+ build.vars['MANDIR'] = os.path.join(DATAROOTDIR, 'man')
def docdir(build, DIR):
if DIR is None:
- DATAROOTDIR, origin = build.vars['DATAROOTDIR']
- PACKAGE, origin2 = build.vars['PACKAGE']
- if origin != 'default' or origin2 != 'default':
- origin = 'derived'
- build.vars['DOCDIR'] = (os.path.join(DATAROOTDIR, 'doc', PACKAGE), origin)
+ DATAROOTDIR = build.vars['DATAROOTDIR']
+ PACKAGE = build.vars['PACKAGE']
+ build.vars['DOCDIR'] = os.path.join(DATAROOTDIR, 'doc', PACKAGE)
def htmldir(build, DIR):
if DIR is None:
- DOCDIR, origin = build.vars['DOCDIR']
- if origin != 'default':
- origin = 'derived'
- build.vars['HTMLDIR'] = (DOCDIR, origin)
+ DOCDIR = build.vars['DOCDIR']
+ build.vars['HTMLDIR'] = DOCDIR
def dvidir(build, DIR):
if DIR is None:
- DOCDIR, origin = build.vars['DOCDIR']
- if origin != 'default':
- origin = 'derived'
- build.vars['DVIDIR'] = (DOCDIR, origin)
+ DOCDIR = build.vars['DOCDIR']
+ build.vars['DVIDIR'] = DOCDIR
def pdfdir(build, DIR):
if DIR is None:
- DOCDIR, origin = build.vars['DOCDIR']
- if origin != 'default':
- origin = 'derived'
- build.vars['PDFDIR'] = (DOCDIR, origin)
+ DOCDIR = build.vars['DOCDIR']
+ build.vars['PDFDIR'] = DOCDIR
def psdir(build, DIR):
if DIR is None:
- DOCDIR, origin = build.vars['DOCDIR']
- if origin != 'default':
- origin = 'derived'
- build.vars['PSDIR'] = (DOCDIR, origin)
+ DOCDIR = build.vars['DOCDIR']
+ build.vars['PSDIR'] = DOCDIR
class Install(ClassyProject):
diff --git a/attoconf/lib/make.py b/attoconf/lib/make.py
index ee58619..b965f28 100644
--- a/attoconf/lib/make.py
+++ b/attoconf/lib/make.py
@@ -42,13 +42,13 @@ class MakeHook(object):
with open(os.path.join(build.builddir, self.outfile), 'w') as out:
print('Generating a makefile ...')
out.write('# This part was generated by %s\n' % full_version)
- build.vars['SRC_DIR'] = (build.relative_source(), 'special')
+ build.vars['SRC_DIR'] = build.relative_source()
for var in build.project.order:
if var is None:
out.write('\n')
continue
- val, origin = build.vars[var]
- out.write('# %s\n%s = %s\n' % (origin, var, val))
+ val = build.vars[var]
+ out.write('%s = %s\n' % (var, val))
if self.infile is not None:
out.write('# The rest was copied from %s\n' % self.infile)
infile = os.path.join(build.project.srcdir, self.infile)
diff --git a/attoconf/lib/templates.py b/attoconf/lib/templates.py
index 791dd62..d6fc24d 100644
--- a/attoconf/lib/templates.py
+++ b/attoconf/lib/templates.py
@@ -29,7 +29,7 @@ class TemplateHook(object):
self.outfiles = outfiles
def __call__(self, build):
- build.vars['SRC_DIR'] = (build.relative_source(), 'special')
+ build.vars['SRC_DIR'] = build.relative_source()
unseen = set(build.project.order)
if None in unseen:
unseen.remove(None)
@@ -42,14 +42,13 @@ class TemplateHook(object):
for var in build.project.order:
if var is None:
continue
- val, origin = build.vars[var]
+ val = build.vars[var]
key = '@' + var + '@'
if key not in slurpee:
continue
if var in unseen:
unseen.remove(var)
slurpee = slurpee.replace(key, str(val))
- # origin is not so useful, given config.status
with open(os.path.join(build.builddir, outfile), 'w') as out:
out.write(slurpee)
if unseen: