Commits

Yu-Jie Lin committed 6a60400

add install_test target for testing package installation

Comments (0)

Files changed (3)

 
 ## Development
 
+* add `install_test` target for testing package installation
+
 ## Version 0.6.1 (2013-08-14T07:41:25Z)
 
 * remove smartypants Python 3 exception, which now supports Python 3 since v1.7.1
+PACKAGE=b.py
+
+INSTALL_TEST_DIR=/tmp/$(PACKAGE)_install_test
+# if version or naming isn't matched to environment, for example, Python 2.6,
+# run the following to override:
+#   make VENV_PY2_CMD=virtualenv-python2.6 install_test
+VENV_PY2_CMD=virtualenv-python2.7
+VENV_PY3_CMD=virtualenv-python3.2
+
 BUILD_CMD=./setup.py sdist --formats gztar,zip bdist_wininst --plat-name win32
 
 build:
 upload:
 	$(BUILD_CMD) upload
 
-.PHONY: build upload
+install_test: $(VENV_PY2_CMD) $(VENV_PY3_CMD)
+
+$(VENV_PY2_CMD) $(VENV_PY3_CMD):
+	rm -rf $(INSTALL_TEST_DIR)
+	$@ $(INSTALL_TEST_DIR)
+	./setup.py sdist --dist-dir $(INSTALL_TEST_DIR)
+	$(INSTALL_TEST_DIR)/bin/pip install $(INSTALL_TEST_DIR)/*.tar.gz
+	. $(INSTALL_TEST_DIR)/bin/activate ; b.py --version ; type b.py
+
+.PHONY: build upload install_test $(VENV_PY2_CMD) $(VENV_PY3_CMD)
     PEP8[^4space] | `python setup.py pep8`
     Pyflakes      | `python setup.py pyflakes`
     Pylint        | `python setup.py pylint`
+    Install       | `make install_test`
+
+    * Install: check if source distribution can be installed by pip. It uses virtualenv to create a temporary environment and installs the package.
 
 I wish *b.py* can support major operating systems and many markup languages someday, even different blogging platform, if possible.
 
 ***Others***
 lnkckr           | [lnkckr][]                                         | 2 / 3
 smartypants      | [smartypants][] >= 1.7.1                           | 2 / 3
+***Tests***
+PEP8             |                                                    | 2 / 3
+Pyflakes         |                                                    | 2 / 3
+Pylint           |                                                    | 2 / 3
+install\_test    | virtualenv, make                                   | 2 / 3
 
 [GoogleAPI]: https://developers.google.com/blogger/docs/3.0/api-lib/python
 [python-wordpress-xmlrpc]: https://github.com/maxcutler/python-wordpress-xmlrpc