chiark / gitweb /
build: Use mdwsetup.py from new CFD. Announce 1.0.2. 1.0.2
authorMark Wooding <mdw@distorted.org.uk>
Sun, 4 Oct 2009 13:18:01 +0000 (14:18 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 4 Oct 2009 13:30:18 +0000 (14:30 +0100)
.gitignore
.links
Makefile
debian/changelog
setup.py

index 7770be258f5b462d03f08a25c65c7e254917b194..678cbf1d54db995f3c9f655b9c8296a3fa390a26 100644 (file)
@@ -7,4 +7,8 @@ deb-build
 build-stamp
 COPYING
 algorithms.h
+RELEASE
+auto-version
+mdwsetup.py
+*.pyc
 python-build-stamp-*
diff --git a/.links b/.links
index 5ecd9c64ade274e86177f1b2a526c9216aa5bbdf..89b2d6f857b7812e9534b452676dab50dc8bbcb6 100644 (file)
--- a/.links
+++ b/.links
@@ -1 +1,2 @@
 COPYING
+auto-version
index b0564e47f6a159a1aa744bdd98ab2cb360de801f..7a24b27ac93c6dbc15f7b5656d1930617c2f088f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,12 +3,14 @@
 PYTHON = python
 prefix = /usr/local
 
+GEN = algorithms.h
+
 all: setup.py
        $(PYTHON) setup.py build
 
 clean: setup.py
        $(PYTHON) setup.py clean
-       rm -rf build
+       rm -rf build $(GEN)
 
 dist: setup.py
        $(PYTHON) setup.py sdist
index a75775aa182e5523c90e86c17520cdde12659e8b..a5494155e4428fcc7e355db3639ccabcf0adb030 100644 (file)
@@ -1,3 +1,9 @@
+catacomb-python (1.0.2) experimental; urgency=low
+
+  * Overhaul build system with new support module.
+
+ -- Mark Wooding <mdw@distorted.org.uk>  Sun, 04 Oct 2009 14:17:20 +0100
+
 catacomb-python (1.0.1) experimental; urgency=low
 
   * Make it work with Python 2.6.  Also switched over to the (increasingly
index cf12885ef87851af93aaca1e4800542364815ed3..927d1d213491dfca25e6085f963534399540b456 100644 (file)
--- a/setup.py
+++ b/setup.py
 #! /usr/bin/python
 
-from distutils.core import setup, Extension
-from os import *
-from os import _exit
-from errno import *
-import sys
-from sys import stdin, stdout, stderr
-
-def progoutput(cmd):
-  p = popen(cmd)
-  out = p.readline()
-  if p.read() != '': raise 'extra junk from %s' % cmd
-  p.close()
-  return out.rstrip('\n')
-
-incdirs = []
-libdirs = []
-libs = []
-
-def libconfig(lib, ver):
-  for i in progoutput('pkg-config "%s >= %s" --cflags' % (lib, ver)).split():
-    if i[:2] == '-I': incdirs.append(i[2:])
-    else: raise 'strange cflags item %s' % i
-  for i in progoutput('pkg-config "%s >= %s" --libs' % (lib, ver)).split():
-    if i[:2] == '-L': libdirs.append(i[2:])
-    elif i[:2] == '-l': libs.append(i[2:])
-    else: raise 'strange libs item %s' % i
-
-def uniquify(l):
-  u = {}
-  o = []
-  for i in l:
-    if i not in u:
-      o.append(i)
-      u[i] = 1
-  return o
-
-libconfig('catacomb', '2.1.1')
-libconfig('mLib', '2.0.4')
-
-class SubprocessFailure (Exception):
-  def __init__(me, file, rc):
-    me.args = (file, rc)
-    me.file = file
-    me.rc = rc
-  def __str__(me):
-    if WIFEXITED(me.rc):
-      return '%s failed (rc = %d)' % (me.file, WEXITSTATUS(me.rc))
-    elif WIFSIGNALED(me.rc):
-      return '%s died (signal %d)' % (me.file, WTERMSIG(me.rc))
-    else:
-      return '%s died inexplicably' % (me.file)
-
-for g in ['algorithms.h']:
-  if type(g) == tuple:
-    fin, fout = g
-  else:
-    root, ext = path.splitext(g)
-    fin = root + '.py'
-    fout = g
-  stin = stat(fin)
-  try:
-    stout = stat(fout)
-    updatep = stin.st_mtime > stout.st_mtime
-  except OSError, err:
-    if err.errno == ENOENT:
-      updatep = True
-    else:
-      raise
-  if updatep:
-    kid = fork()
-    print 'running %s to create %s' % (fin, fout)
-    fnew = fout + '.new'
-    if kid == 0:
-      try:
-       out = file(fnew, 'w')
-       dup2(out.fileno(), stdout.fileno())
-       out.close()
-       execl(sys.executable, sys.executable, fin)
-      except:
-       stderr.write('error running %s -> %s: %s\n' %
-                    (fin, fout, sys.exc_info()[1]))
-       _exit(127)
-    _, rc = waitpid(kid, 0)
-    if rc:
-      raise SubprocessFailure, (fin, rc)
-    rename(fnew, fout)
-
-cat = Extension('catacomb._base',
-               ['catacomb.c', 'bytestring.c', 'buffer.c',
-                'rand.c', 'algorithms.c', 'pubkey.c', 'pgen.c',
-                'mp.c', 'field.c', 'ec.c', 'group.c', 'passphrase.c',
-                'share.c', 'key.c', 'util.c'],
-               ##extra_compile_args = ['-O0'],
-               include_dirs = uniquify(incdirs),
-               library_dirs = uniquify(libdirs),
-               libraries = uniquify(libs))
-
-setup(name = 'catacomb-python',
-      version = '1.0.0',
-      description = 'Interface to Catacomb cryptographic library',
-      url = 'http://www.distorted.org.uk/~mdw/Catacomb-2.1.0',
-      author = 'Straylight/Edgeware',
-      author_email = 'mdw@distorted.org.uk',
-      license = 'GNU General Public License',
-      packages = ['catacomb'],
-      scripts = ['pwsafe'],
-      ext_modules = [cat])
+import os as OS
+import subprocess as SUB
+
+import distutils.core as DC
+import mdwsetup as MS
+
+MS.pkg_config('catacomb', '2.1.1')
+MS.pkg_config('mLib', '2.0.4')
+
+MS.generate('algorithms.h')
+
+cat = DC.Extension('catacomb._base',
+                   ['catacomb.c', 'bytestring.c', 'buffer.c',
+                    'rand.c', 'algorithms.c', 'pubkey.c', 'pgen.c',
+                    'mp.c', 'field.c', 'ec.c', 'group.c', 'passphrase.c',
+                    'share.c', 'key.c', 'util.c'],
+                   ##extra_compile_args = ['-O0'],
+                   include_dirs = MS.uniquify(MS.INCLUDEDIRS),
+                   library_dirs = MS.uniquify(MS.LIBDIRS),
+                   libraries = MS.uniquify(MS.LIBS))
+
+DC.setup(name = 'catacomb-python',
+         version = MS.auto_version(),
+         description = 'Interface to Catacomb cryptographic library',
+         url = 'http://www.distorted.org.uk/~mdw/Catacomb-2.1.0',
+         author = 'Straylight/Edgeware',
+         author_email = 'mdw@distorted.org.uk',
+         license = 'GNU General Public License',
+         packages = ['catacomb'],
+         scripts = ['pwsafe'],
+         ext_modules = [cat])