summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2007-12-02 00:27:05 +0100
committerHans Ulrich Niedermann <hun@n-dimensional.de>2007-12-02 00:27:05 +0100
commitfdabb0e9bcde5fe31071ce38fcab5a0483fcf03c (patch)
treef3d566ade6a426036b5373b564f5f9650914eee7
parent0475958f659b97f7306f4061cb2b3eeb29dbca8a (diff)
Add pythonic stuff forgotten the last time
-rw-r--r--include/README1
-rw-r--r--include/config.h.in22
-rw-r--r--nbb/Makefile-files14
-rw-r--r--nbb/nbb.in17
-rw-r--r--nbb/nbb_lib.in59
5 files changed, 113 insertions, 0 deletions
diff --git a/include/README b/include/README
new file mode 100644
index 0000000..792d600
--- /dev/null
+++ b/include/README
@@ -0,0 +1 @@
+#
diff --git a/include/config.h.in b/include/config.h.in
new file mode 100644
index 0000000..f6fee68
--- /dev/null
+++ b/include/config.h.in
@@ -0,0 +1,22 @@
+/* include/config.h.in. Generated from configure.ac by autoheader. */
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Version number of package */
+#undef VERSION
diff --git a/nbb/Makefile-files b/nbb/Makefile-files
new file mode 100644
index 0000000..76d1151
--- /dev/null
+++ b/nbb/Makefile-files
@@ -0,0 +1,14 @@
+# -*- makefile -*-
+
+# TESTS += nbb/nbb
+bin_SCRIPTS += nbb/nbb
+EXTRA_DIST += nbb/nbb.in
+
+all-local: nbb/nbb
+ chmod +x nbb/nbb
+
+nbb/nbb: nbb/nbb_lib.py
+
+python_PYTHON += nbb/nbb_lib.py
+
+# End of Makefile-files.
diff --git a/nbb/nbb.in b/nbb/nbb.in
new file mode 100644
index 0000000..3045d2f
--- /dev/null
+++ b/nbb/nbb.in
@@ -0,0 +1,17 @@
+#!@PYTHON@
+
+import sys
+
+if __name__ == '__main__':
+ try:
+ sys.stdout.write("sys.path=%s\n" % repr(sys.path))
+ sys.stdout.flush()
+ import nbb_lib
+ nbb_lib.main(sys.argv)
+ except ImportError, e:
+ sys.stderr.write("nbb: Fatal: Could not load nbb_lib.\n")
+ sys.exit(3)
+
+# Local Variables:
+# mode: python
+# End:
diff --git a/nbb/nbb_lib.in b/nbb/nbb_lib.in
new file mode 100644
index 0000000..cfe3428
--- /dev/null
+++ b/nbb/nbb_lib.in
@@ -0,0 +1,59 @@
+import sys
+import os
+from subprocess import Popen
+import subprocess
+
+class AbstractSourceTree(object):
+ def __init__(self, srcdir):
+ raise "Moo"
+
+srctree_classes = []
+
+def prog_stdout(call_list):
+ p = Popen(call_list, stdout=subprocess.PIPE)
+ stdout, stderr = p.communicate()
+ return stdout.strip()
+
+class GitSourceTree(object):
+ def __init__(self, srcdir):
+ if "true" != prog_stdout(["git", "rev-parse", "--is-inside-work-tree"]):
+ raise "Not a git sourcetree"
+ self.top_srcdir = os.path.join(srcdir,
+
+srctree_classes.append(GitSourceTree)
+
+def get_sourcetree(srcdir):
+ for cls in srctree_classes:
+ try:
+ return cls(srcdir)
+ except "Moo":
+ pass
+ raise "Source tree type for '%s' not detected" % (srcdir,)
+
+class NBB(object):
+ def __init__(self):
+ srcdir = os.getcwd()
+ self.sourcetree = get_sourcetree(srcdir)
+
+def main(argv):
+ prog = argv[0]
+ idx = prog.rfind('/')
+ if idx >= 0:
+ prog = prog[idx+1:]
+ for arg in argv[1:]:
+ if arg in ('-h', '--help'):
+ print "Usage: %(prog)s" % locals()
+ return
+ elif arg in ('-V', '--version'):
+ print "%(prog)s (@PACKAGE_NAME@) @PACKAGE_VERSION@"
+ return
+ else:
+ pass
+ nbb = NBB()
+
+if __name__ == '__main__':
+ raise "This is not a library"
+
+# Local Variables:
+# mode: python
+# End: