buildsystem reorg
authorMarko Kreen <markokr@gmail.com>
Fri, 5 Jun 2009 12:34:06 +0000 (15:34 +0300)
committerMarko Kreen <markokr@gmail.com>
Sun, 7 Jun 2009 15:19:39 +0000 (18:19 +0300)
- put python modules under 'skytools-3.0'
- install pkgloader separately
- install scripts in Makefile instead setup.py (it did not support rename)
  removing .py afterwards is dangerous as we may overwrite old scripts.
- move setup.py under misc/ as it really is not usable standalone
- drop override PYTHON

Makefile
config.mak.in
misc/strip_ext.py [deleted file]
setup_pkgloader.py [new file with mode: 0755]
setup_skytools.py [moved from setup.py with 71% similarity]
source.cfg

index 86c5885eededa6f8fda560d0ca6290f8b6dd662c..976597d3d5ad7a2fa5c6192704c66b5da9d4d277 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,10 @@ pyver = $(shell $(PYTHON) -V 2>&1 | sed 's/^[^ ]* \([0-9]*\.[0-9]*\).*/\1/')
 
 SUBDIRS = sql doc
 
+SCRIPTS = python/londiste.py python/qadmin.py python/pgqadm.py python/walmgr.py \
+         scripts/queue_loader.py scripts/queue_mover.py scripts/queue_splitter.py \
+         scripts/scriptmgr.py scripts/skytools_upgrade.py
+
 all: python-all sub-all config.mak
 
 install: sub-install python-install
@@ -19,10 +23,10 @@ sub-all sub-install sub-clean sub-distclean:
 .PHONY: sub-all sub-clean sub-install sub-distclean
 
 python-all: config.mak
-       $(PYTHON) setup.py build
+       $(PYTHON) setup_skytools.py build
 
 clean: sub-clean
-       $(PYTHON) setup.py clean
+       $(PYTHON) setup_skytools.py clean
        rm -rf build
        find python -name '*.py[oc]' -print | xargs rm -f
        rm -f python/skytools/installer_config.py source.list
@@ -40,10 +44,17 @@ modules-install: config.mak
        test \! -d compat || $(MAKE) -C compat $@ DESTDIR=$(DESTDIR)
 
 python-install: config.mak sub-all
-       $(PYTHON) setup.py install --prefix=$(prefix) --root=$(DESTDIR)/ --record=tmp_files.lst
-       grep '/bin/[a-z_0-9]*.py' tmp_files.lst \
-       | $(PYTHON) misc/strip_ext.py $(if $(DESTDIR), $(DESTDIR), /)
-       rm -f tmp_files.lst
+       mkdir -p $(DESTDIR)/$(bindir)
+       $(PYTHON) setup_pkgloader.py install --prefix=$(prefix) --root=$(DESTDIR)/
+       $(PYTHON) setup_skytools.py install --prefix=$(prefix) --root=$(DESTDIR)/ --record=tmp_files.lst \
+               --install-lib=$(prefix)/lib/python$(pyver)/site-packages/skytools-3.0
+       for s in $(SCRIPTS); do \
+               exe=`echo $$s|sed -e 's!.*/!!' -e 's/[.]py//'`; \
+               install $$s $(DESTDIR)/$(bindir)/$$exe || exit 1; \
+       done
+       #grep '/bin/[a-z_0-9]*.py' tmp_files.lst \
+       #| $(PYTHON) misc/strip_ext.py $(if $(DESTDIR), $(DESTDIR), /)
+       #rm -f tmp_files.lst
        $(MAKE) -C doc DESTDIR=$(DESTDIR) install
 
 python-install python-all: python/skytools/installer_config.py
@@ -93,7 +104,7 @@ deb84:
 tgz: config.mak clean
        $(MAKE) -C doc man html
        rm -f source.list
-       $(PYTHON) setup.py sdist -t source.cfg -m source.list
+       $(PYTHON) setup_skytools.py sdist -t source.cfg -m source.list
 
 debclean: distclean
        rm -rf debian/tmp-* debian/build* debian/control debian/packages-tmp*
index bc7f41ce0c32d2cf3896d0828e2a8ace081468d2..894c8c9830d3f7ccea05297a26ec24ace1602727 100644 (file)
@@ -11,7 +11,7 @@ PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 
-override PYTHON = @PYTHON@
+PYTHON = @PYTHON@
 override PG_CONFIG = @PG_CONFIG@
 
 # additional CPPFLAGS to pgxs modules
diff --git a/misc/strip_ext.py b/misc/strip_ext.py
deleted file mode 100644 (file)
index 240cc04..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#! /usr/bin/env python
-
-import sys, os, os.path
-
-while 1:
-    fn = sys.stdin.readline().strip()
-    if not fn:
-        break
-    full1 = os.path.join(sys.argv[1], fn)
-    full2 = os.path.splitext(full1)[0]
-    if full1 == full2:
-        continue
-    print full1, full2
-    os.rename(full1, full2)
-
diff --git a/setup_pkgloader.py b/setup_pkgloader.py
new file mode 100755 (executable)
index 0000000..28b15d7
--- /dev/null
@@ -0,0 +1,14 @@
+#! /usr/bin/env python
+
+from distutils.core import setup
+
+setup(
+    name = "pkgloader",
+    license = "BSD",
+    version = '1.0',
+    maintainer = "Marko Kreen",
+    maintainer_email = "markokr@gmail.com",
+    package_dir = {'': 'python'},
+    py_modules = ['pkgloader'],
+)
+
similarity index 71%
rename from setup.py
rename to setup_skytools.py
index 7f9ab7049b20eb59963826eea8e4fead2cac423d..0e1628d9d342633c3e38517cd19c7f2c3dfa9a1d 100755 (executable)
--- a/setup.py
@@ -1,5 +1,8 @@
 #! /usr/bin/env python
 
+# this script does not perform full installation,
+# it is meant for use from Makefile
+
 import sys, os.path, re
 from distutils.core import setup
 from distutils.extension import Extension
@@ -34,19 +37,6 @@ setup(
     url = "http://pgfoundry.org/projects/skytools/",
     package_dir = {'': 'python'},
     packages = ['skytools', 'londiste', 'pgq', 'pgq.cascade'],
-    scripts = ['python/londiste.py',
-               'python/qadmin.py',
-               'python/pgqadm.py',
-               'python/walmgr.py',
-               'scripts/bulk_loader.py',
-               'scripts/cube_dispatcher.py',
-               'scripts/queue_loader.py',
-               'scripts/queue_mover.py',
-               'scripts/queue_splitter.py',
-               'scripts/scriptmgr.py',
-               'scripts/skytools_upgrade.py',
-               'scripts/table_dispatcher.py',
-               ],
     data_files = [
       ('share/doc/skytools/conf', [
         'python/conf/wal-master.ini',
index 21ca1d415549e06353789f890567c0e7db187409..3cab494d56a3c909d9fef707845be9c0c5b3af08 100644 (file)
@@ -6,7 +6,7 @@ include Makefile COPYRIGHT README NEWS config.mak.in configure configure.ac sour
 
 recursive-include sql *.sql Makefile *.out *.in *.[ch] README* *.ini *.templ
 recursive-include python/conf *.ini
-recursive-include misc *.sh *.rc *.py Cindent
+recursive-include misc *.sh *.rc *.py *.css Cindent
 recursive-include scripts *.py *.templ *.ini
 recursive-include lib *.[ch] Makefile Setup.mk README COPYRIGHT
 recursive-include debian changelog packages.in