Repository :
http://git.fedorahosted.org/cgit/cura-tools.git
On branch : openlmi-tools-lmiwbem
---------------------------------------------------------------
commit 4dd6b72c5b80e2191b71e5a18d2299f0d86a4880
Author: Michal Minar <miminar(a)redhat.com>
Date: Thu May 22 10:52:07 2014 +0200
generate setup files from template
cli/lmi/shell/LMIShellVersion.py module. Therefor setup modules are now
generated from templates where @@VERSION@@ macros are replaced with
proper version string.
# make setup
needs to be run first in pristine repository clone.
---------------------------------------------------------------
Makefile | 16 ++++++++++++++
Makefile.inc | 18 ++++++++++++++++
cli/Makefile | 41 ++++++++++++++++++++++++++++++++----
cli/lmi/shell/LMIShellVersion.py | 2 +-
cli/{setup.py => setup.py.skel} | 3 +-
doc/src/Makefile | 6 +++-
doc/src/{conf.py => conf.py.skel} | 4 +-
7 files changed, 78 insertions(+), 12 deletions(-)
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..7e27481
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,16 @@
+.PHONY: all doc setup clean
+
+all: doc
+
+doc: setup
+ make -C doc html
+
+setup:
+ make -C cli setup
+ make -C doc/src setup
+
+clean:
+ make -C cli clean
+ make -C doc clean
+
+# ex: ft=make noet sw=8 ts=8
diff --git a/Makefile.inc b/Makefile.inc
new file mode 100644
index 0000000..7b8025c
--- /dev/null
+++ b/Makefile.inc
@@ -0,0 +1,18 @@
+SELFDIR = $(dir $(lastword $(MAKEFILE_LIST)))
+ROOTDIR := $(SELFDIR)
+VERSION ?= $(shell PYTHONPATH=$(ROOTDIR/cli) python -c \
+ 'print(__import__("lmi.shell",
fromlist=["__version__"]).__version__)')
+TEMPLATES := $(wildcard *.py.skel)
+TARGETS := $(basename $(TEMPLATES))
+
+.PHONY: setup clean-setup
+
+setup: $(TARGETS)
+
+%.py: %.py.skel
+ sed 's/@@VERSION@@/$(VERSION)/g' <$? >$@
+
+clean-setup:
+ rm -rf $(TARGETS)
+
+# ex: ft=make noet sw=8 ts=8
diff --git a/cli/Makefile b/cli/Makefile
index f9b6e54..b15c149 100644
--- a/cli/Makefile
+++ b/cli/Makefile
@@ -1,12 +1,43 @@
-SOURCE ?= README.md
-TARGET ?= README.txt
+include ../Makefile.inc
-.PHONY: readme
+PYTHONPATH ?= $(HOME)/workspace/python_sandbox
+DEVELOPDIR ?= $(PYTHONPATH)
+DOCDIR := $(ROOTDIR)/doc
+SOURCE ?= README.md
+TARGET ?= README.txt
+
+.PHONY: all readme sdist clean setup develop
+
+all: sdist
+
+sdist: setup .$(VERSION).sdist
+
+.$(VERSION).sdist:
+ python setup.py sdist
+ touch $@
+
+develop: setup
+ python setup.py develop --install-dir=$(DEVELOPDIR)
readme:
pandoc --from=markdown --to=rst -o $(TARGET) $(SOURCE)
-clean:
- -rm $(TARGET)
+upload: setup .$(VERSION).upload
+
+.$(VERSION).upload:
+ python setup.py sdist upload
+ touch $@
+
+upload_docs: setup .$(VERSION).upload_docs
+
+.$(VERSION).upload_docs:
+ make -C $(DOCDIR) html
+ python setup.py upload_docs
+ touch $@
+
+clean: clean-setup
+ -rm README*.txt
+ -rm -rf dist/
+ -rm .$(VERSION).*
# ex: ft=make noet sw=8 ts=8
diff --git a/cli/lmi/shell/LMIShellVersion.py b/cli/lmi/shell/LMIShellVersion.py
index 1bac7e4..af52754 100644
--- a/cli/lmi/shell/LMIShellVersion.py
+++ b/cli/lmi/shell/LMIShellVersion.py
@@ -13,4 +13,4 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <
http://www.gnu.org/licenses/>.
-__version__ = "0.9.1"
+__version__ = "0.9.1.1"
diff --git a/cli/setup.py b/cli/setup.py.skel
similarity index 98%
rename from cli/setup.py
rename to cli/setup.py.skel
index 3c007f6..bd71ec3 100644
--- a/cli/setup.py
+++ b/cli/setup.py.skel
@@ -17,7 +17,6 @@ import os
import subprocess
import sys
from setuptools import setup, find_packages
-from lmi.shell import __version__
long_description = ""
try:
@@ -43,7 +42,7 @@ setup(
name="openlmi-tools",
description="OpenLMI (non)interactive shell and meta-command",
long_description=long_description,
- version=__version__,
+ version='@@VERSION@@',
license="GPLv2+",
url="http://fedorahosted.org/openlmi/",
author="Peter Hatina, Michal Minar",
diff --git a/doc/src/Makefile b/doc/src/Makefile
index 787d0b0..3728ee0 100644
--- a/doc/src/Makefile
+++ b/doc/src/Makefile
@@ -1,3 +1,5 @@
+include ../../Makefile.inc
+
BUILDDIR = ../build
SPHINXBUILD ?= sphinx-build
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
@@ -6,7 +8,7 @@ PROJECTNAME := OpenLMITools
.PHONY: clean deps
-deps:
+deps: setup
make -C scripts
make -C shell
@@ -20,6 +22,6 @@ latexpdf.build: latex.build
./build-with-sphinx.sh -b $* $(ALLSPHINXOPTS) $(BUILDDIR)/$*
@echo "$* build finished. Output is in $(BUILDDIR)/$*."
-clean:
+clean: clean-setup
make -C scripts clean
make -C shell clean
diff --git a/doc/src/conf.py b/doc/src/conf.py.skel
similarity index 99%
rename from doc/src/conf.py
rename to doc/src/conf.py.skel
index e1f2690..f3be3a4 100644
--- a/doc/src/conf.py
+++ b/doc/src/conf.py.skel
@@ -106,9 +106,9 @@ copyright = '2012-2014, Red Hat Inc.'
# built documents.
#
# The short X.Y version.
-version = '0.9.1'
+version = '@@VERSION@@'
# The full version, including alpha/beta/rc tags.
-release = '0.9.1'
+release = '@@VERSION@@'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.