bugfix - sequels of moving to format() from old-style %-formatting
[nepi.git] / Makefile
index 039820b..118c778 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,14 +4,17 @@ TESTLIB  = $(TESTDIR)/lib
 BUILDDIR    = $(CURDIR)/build
 DISTDIR     = $(CURDIR)/dist
 
-# stupid distutils, it's broken in so many ways
 SUBBUILDDIR = $(shell python -c 'import distutils.util, sys; \
              print "lib.%s-%s" % (distutils.util.get_platform(), \
              sys.version[0:3])')
 PYTHON25 := $(shell python -c 'import sys; v = sys.version_info; \
     print (1 if v[0] <= 2 and v[1] <= 5 else 0)')
 
+ifeq ($(PYTHON25),0)
+BUILDDIR := $(BUILDDIR)/$(SUBBUILDDIR)
+else
 BUILDDIR := $(BUILDDIR)/lib
+endif
 
 PYPATH = $(BUILDDIR):$(TESTLIB):$(PYTHONPATH)
 COVERAGE = $(or $(shell which coverage), $(shell which python-coverage), \
@@ -32,7 +35,7 @@ test: all
 
 test-one: all
        echo $(file) $(case)
-       PYTHONPATH="$(PYPATH)" python $(file) $(case)
+       PYTHONPATH="$(PYPATH)" $(file) $(case)
 
 coverage: all
        rm -f .coverage
@@ -61,3 +64,18 @@ dist: MANIFEST
        ./setup.py sdist
 
 .PHONY: all clean distclean dist test coverage install MANIFEST
+
+########## for uploading onto pypi
+# use pypitest instead for tests (both entries need to be defined in your .pypirc)
+PYPI_TARGET=pypi
+PYPI_TARBALL_HOST=root@build.onelab.eu
+PYPI_TARBALL_TOPDIR=/build/nepi
+
+VERSIONTAG=$(shell cat VERSION)
+
+# run this only once the sources are in on the right tag
+pypi: 
+       setup.py sdist upload -r $(PYPI_TARGET)
+       ssh $(PYPI_TARBALL_HOST) mkdir -p $(PYPI_TARBALL_TOPDIR)/$(VERSIONTAG)
+       rsync -av dist/nepi-$(VERSIONTAG).tar.gz $(PYPI_TARBALL_HOST):$(PYPI_TARBALL_TOPDIR)/
+