diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2013-08-06 14:44:13 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2013-08-06 14:45:49 -0700 |
commit | b26aadbf16f4873411f77f08ebdd228528c5723b (patch) | |
tree | 6d8fc832aed437a159fc1ee162f826c486671428 /attoconf/lib | |
parent | 46e9b987ff689c1acfe29c7b980298408d1b95a6 (diff) | |
download | attobuild-b26aadbf16f4873411f77f08ebdd228528c5723b.tar.gz attobuild-b26aadbf16f4873411f77f08ebdd228528c5723b.tar.bz2 attobuild-b26aadbf16f4873411f77f08ebdd228528c5723b.tar.xz attobuild-b26aadbf16f4873411f77f08ebdd228528c5723b.zip |
Move all types to their own module
Diffstat (limited to 'attoconf/lib')
-rw-r--r-- | attoconf/lib/arches.py | 10 | ||||
-rw-r--r-- | attoconf/lib/c.py | 16 | ||||
-rw-r--r-- | attoconf/lib/install.py | 25 | ||||
-rw-r--r-- | attoconf/lib/lex.py | 4 | ||||
-rw-r--r-- | attoconf/lib/yacc.py | 4 |
5 files changed, 15 insertions, 44 deletions
diff --git a/attoconf/lib/arches.py b/attoconf/lib/arches.py index bafef38..c168292 100644 --- a/attoconf/lib/arches.py +++ b/attoconf/lib/arches.py @@ -18,15 +18,7 @@ from __future__ import print_function, division, absolute_import from ..classy import ClassyProject - -def triple(s): - # Triples do not, in fact, follow a regular pattern. - # Some have only two segments, some appear to have four ... - # Also, sometimes a wrong thing is used as a triple. - # All we *really* care about is generating the tool names. - if s.startswith('-') or s.endswith('-') or '-' not in s[1:-1]: - raise ValueError('Probably not a triple') - return s +from ..types import triple def host(build, HOST): if HOST is None: diff --git a/attoconf/lib/c.py b/attoconf/lib/c.py index 75bf931..c4eefdb 100644 --- a/attoconf/lib/c.py +++ b/attoconf/lib/c.py @@ -19,10 +19,10 @@ from __future__ import print_function, division, absolute_import import errno import os -from shlex import split as shell import subprocess from .arches import Arches2 +from ..types import ShellList class TestError(Exception): pass @@ -229,11 +229,11 @@ class Link(Arches2): def vars(self): super(Link, self).vars() self.add_option('LDFLAGS', init=[], - type=shell, check=ldflags, + type=ShellList, check=ldflags, help='linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>', hidden=False) self.add_option('LIBS', init=[], - type=shell, check=libs, + type=ShellList, check=libs, help='libraries to pass to the linker, e.g. -l<library>', hidden=False) @@ -242,7 +242,7 @@ class Preprocess(Arches2): def vars(self): super(Preprocess, self).vars() self.add_option('CPPFLAGS', init=[], - type=shell, check=cppflags, + type=ShellList, check=cppflags, help='C/C++/Objective C preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>', hidden=False) @@ -251,10 +251,10 @@ class C(Link, Preprocess): def vars(self): super(C, self).vars() self.add_option('CC', init=['gcc'], - type=shell, check=cc, + type=ShellList, check=cc, help='C compiler command', hidden=False) self.add_option('CFLAGS', init=['-O2', '-g'], - type=shell, check=cflags, + type=ShellList, check=cflags, help='C compiler flags', hidden=False) class Cxx(Link, Preprocess): @@ -262,8 +262,8 @@ class Cxx(Link, Preprocess): def vars(self): super(Cxx, self).vars() self.add_option('CXX', init=['g++'], - type=shell, check=cxx, + type=ShellList, check=cxx, help='C++ compiler command', hidden=False) self.add_option('CXXFLAGS', init=['-O2', '-g'], - type=shell, check=cxxflags, + type=ShellList, check=cxxflags, help='C++ compiler flags', hidden=False) diff --git a/attoconf/lib/install.py b/attoconf/lib/install.py index 3e135e8..d8d6cf5 100644 --- a/attoconf/lib/install.py +++ b/attoconf/lib/install.py @@ -20,28 +20,7 @@ from __future__ import print_function, division, absolute_import import os from ..classy import ClassyProject -from ..core import trim_trailing_slashes - - -def word(s): - if ' ' in s: - raise ValueError('not a word: %s' % s) - return s - - -def version(s): - if s.startswith('v'): - s = s[1:] - [int(b) for b in s.split('.')] - return s - - -def filepath(s): - s = trim_trailing_slashes(s) - # must be absolute *and* canonical - if s != os.path.abspath(s): - raise ValueError('Not an absolute, canonical pathname: %s' % s) - return s +from ..types import shell_word, version, filepath def exec_prefix(build, EPREFIX): @@ -208,7 +187,7 @@ class Install(ClassyProject): def general(self): super(Install, self).general() self.add_option('--package', init=self.package, - type=word, check=None, + type=shell_word, check=None, help='Short name of this package (don\'t change!)', hidden=True) self.add_option('--package-version', init=self.package_version, diff --git a/attoconf/lib/lex.py b/attoconf/lib/lex.py index d25455b..5f8ff43 100644 --- a/attoconf/lib/lex.py +++ b/attoconf/lib/lex.py @@ -18,7 +18,7 @@ from __future__ import print_function, division, absolute_import from ..classy import ClassyProject -from .c import shell +from ..types import ShellList def flex(build, FLEX): # TODO actually test it @@ -29,6 +29,6 @@ class Flex(ClassyProject): def vars(self): super(Flex, self).vars() self.add_option('FLEX', init=['flex'], - type=shell, check=flex, + type=ShellList, check=flex, help='Lexical analyzer command', hidden=False) diff --git a/attoconf/lib/yacc.py b/attoconf/lib/yacc.py index c8ddb03..885bbd3 100644 --- a/attoconf/lib/yacc.py +++ b/attoconf/lib/yacc.py @@ -18,7 +18,7 @@ from __future__ import print_function, division, absolute_import from ..classy import ClassyProject -from .c import shell +from ..types import ShellList def bison(build, BISON): # TODO actually test it @@ -29,6 +29,6 @@ class Bison(ClassyProject): def vars(self): super(Bison, self).vars() self.add_option('BISON', init=['bison'], - type=shell, check=bison, + type=ShellList, check=bison, help='Lexical analyzer command', hidden=False) |