From a3405560a639e8ee90457d78a9b393dde91d8781 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Thu, 1 Aug 2013 18:21:47 -0700 Subject: Initial commit of the final draft of attoconf --- README | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 README (limited to 'README') diff --git a/README b/README new file mode 100644 index 0000000..2497de8 --- /dev/null +++ b/README @@ -0,0 +1,7 @@ +Attoconf is A small and sensible replacement for GNU autoconf. + +Principles: +* Assume most build environments are sane, and ignore the rest. +* Never automatically toggle features based on the build environment. +* Written in python2 for easy editing and wide portability. +* GPL, but this does not apply to the program being built. -- cgit v1.2.3-70-g09d2 From cd3e62f10f4cd85fe74199349c96e7f2f27c4f60 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sun, 22 Sep 2013 09:28:35 -0700 Subject: Implement config.status --- README | 3 ++- attoconf/_version.py | 2 +- attoconf/core.py | 19 ++++++++++++++++--- 3 files changed, 19 insertions(+), 5 deletions(-) (limited to 'README') diff --git a/README b/README index 2497de8..c76a0ce 100644 --- a/README +++ b/README @@ -1,7 +1,8 @@ -Attoconf is A small and sensible replacement for GNU autoconf. +Attoconf is a small and sensible replacement for GNU autoconf. Principles: * Assume most build environments are sane, and ignore the rest. +* In the face of ambiguity, refuse the temptation to guess. * Never automatically toggle features based on the build environment. * Written in python2 for easy editing and wide portability. * GPL, but this does not apply to the program being built. diff --git a/attoconf/_version.py b/attoconf/_version.py index 68a4244..76c1c3d 100644 --- a/attoconf/_version.py +++ b/attoconf/_version.py @@ -11,7 +11,7 @@ minor = 6 # 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 7efd91c..624d578 100644 --- a/attoconf/core.py +++ b/attoconf/core.py @@ -146,6 +146,7 @@ class Build(object): 'builddir', 'project', 'vars', + '_seen_args', ) def __init__(self, project, builddir): ''' A Build is initially constructed from a project and a build dir. @@ -155,6 +156,7 @@ class Build(object): self.vars = {o.var: (o.init, 'default') for o in project.options.itervalues() if o.var is not None} + self._seen_args = [] def apply_arg(self, arg): ''' Parse a single argument, expanding aliases. @@ -174,6 +176,7 @@ class Build(object): raise ArgumentError('Unknown option %s' % arg) else: raise ArgumentError('Unknown environment variable %s' % arg) + self._seen_args.append(arg) k, a = arg.split('=', 1) opt = self.project.options.get(k) @@ -187,6 +190,18 @@ class Build(object): ''' for check in self.project.checks: check(self) + status_file = os.path.join(self.builddir, 'config.status') + # open fd to control +x mode + status_fd = os.open(status_file, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0777) + with os.fdopen(status_fd, 'w') as status: + status.write('#!%s\n' % sys.executable) + status.write('import os\n') + status.write('import sys\n') + status.write('old_build_dir = os.path.dirname(sys.argv[0])\n') + status.write('configure = os.path.join(old_build_dir, %r, "configure")\n' + % self.relative_source()) + status.write('os.execvp(configure, [configure] + %r)\n' + % self._seen_args) def configure(self, args, env): ''' First apply variables from the environment, @@ -210,9 +225,7 @@ class Build(object): ''' srcdir = self.project.srcdir builddir = self.builddir - if os.path.isabs(srcdir): - return srcdir - if os.path.isabs(builddir): + if os.path.isabs(srcdir) or os.path.isabs(builddir): return os.path.realpath(srcdir) return os.path.relpath(os.path.realpath(srcdir), os.path.realpath(builddir)) -- cgit v1.2.3-70-g09d2 From 6bfc88d0b0613dab1b25de913311cbeedfff3132 Mon Sep 17 00:00:00 2001 From: Fedja Beader Date: Tue, 12 Dec 2023 21:26:41 +0100 Subject: Update README and demo project to python3 Update py2->py3 in README Not strictly necessary, but use python3 directly + remove py2 compatibility line Use python3 explicity. Debian (CI) does not have a python->python3 link? --- README | 2 +- demo-project/configure | 4 +--- test-everything.sh | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'README') diff --git a/README b/README index c76a0ce..41c08b5 100644 --- a/README +++ b/README @@ -4,5 +4,5 @@ Principles: * Assume most build environments are sane, and ignore the rest. * In the face of ambiguity, refuse the temptation to guess. * Never automatically toggle features based on the build environment. -* Written in python2 for easy editing and wide portability. +* Written in python3 for easy editing and wide portability. * GPL, but this does not apply to the program being built. diff --git a/demo-project/configure b/demo-project/configure index 47022c2..61a2c2e 100755 --- a/demo-project/configure +++ b/demo-project/configure @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2013 Ben Longbons # @@ -17,8 +17,6 @@ # You should have received a copy of the GNU General Public License # along with attoconf. If not, see . -from __future__ import print_function, division, absolute_import - import os import sys diff --git a/test-everything.sh b/test-everything.sh index 64fc89d..c45ad00 100755 --- a/test-everything.sh +++ b/test-everything.sh @@ -1,5 +1,6 @@ #!/bin/sh -e -python -m unittest discover "$@" +python3 -m unittest discover "$@" + mkdir -p demo-build cd demo-build ../demo-project/configure -- cgit v1.2.3-70-g09d2