]> git.phdru.name Git - cookiecutter.git/commitdiff
Update: makefiles, sphinx docs, tests
authorOleg Broytman <phd@phdru.name>
Sat, 16 Jul 2016 23:28:27 +0000 (02:28 +0300)
committerOleg Broytman <phd@phdru.name>
Sat, 16 Jul 2016 23:28:27 +0000 (02:28 +0300)
14 files changed:
project_template/MANIFEST.in
project_template/Makefile [new file with mode: 0644]
project_template/docs/.gitignore [new file with mode: 0644]
project_template/docs/genapidocs [new file with mode: 0755]
project_template/mk-distr
project_template/publish-docs [new file with mode: 0755]
project_template/requirements.txt
project_template/setup.cfg
project_template/setup.py
project_template/tests/Makefile [new file with mode: 0644]
project_template/tests/__init__.py [new file with mode: 0644]
project_template/tests/run_all.py [new file with mode: 0755]
project_template/tests/test_test.py [new file with mode: 0755]
project_template/update [new file with mode: 0755]

index bf0c60b3c57af9efd00d2bc7d9284cd57051d7b8..5014cb5d4147335524b6b35753dd74950c6d7ba6 100644 (file)
@@ -1,2 +1,4 @@
-include COPYING ChangeLog MANIFEST.in README.txt TODO mk-distr requirements.txt
-recursive-include project *.py
+include docs/genapidocs
+include COPYING ChangeLog MANIFEST.in Makefile TODO mk-distr *.txt
+recursive-include docs Makefile *.py *.rst *.txt *.css *.js *.html *.gif *.png
+recursive-include tests Makefile *.py
diff --git a/project_template/Makefile b/project_template/Makefile
new file mode 100644 (file)
index 0000000..fc9c35e
--- /dev/null
@@ -0,0 +1,30 @@
+
+.PHONY: all
+all:
+       @echo "Nothing to be done for 'all'"
+
+.PHONY: release
+release: tests flake8 html distr
+
+.PHONY: distr
+distr:
+       ./mk-distr
+
+.PHONY: flake8
+flake8:
+       flake8
+
+.PHONY: html
+html:
+       $(MAKE) -C docs html
+
+.PHONY: test
+test:
+       $(MAKE) -C tests
+
+.PHONY: tests
+tests: test
+
+.PHONY: clean
+clean:
+       find . -name '*.py[co]' -type f -delete
diff --git a/project_template/docs/.gitignore b/project_template/docs/.gitignore
new file mode 100644 (file)
index 0000000..2be7eb5
--- /dev/null
@@ -0,0 +1,4 @@
+/_build/
+/_static/
+/_templates/
+/api/
diff --git a/project_template/docs/genapidocs b/project_template/docs/genapidocs
new file mode 100755 (executable)
index 0000000..533956b
--- /dev/null
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+cd "`dirname $0`"/.. &&
+exec sphinx-apidoc -Me -o docs/api project
index 8576eac8ee7f67b9cd7c8a8625dd0450ea92aa9a..6c946f62de842245c15bfa8485841baba5aefbae 100755 (executable)
@@ -5,6 +5,10 @@ umask 022 &&
 git archive --format=tar --prefix=project/ "${1:-HEAD}" |
    (cd "$HOME/tmp" && exec tar xf -) &&
 
+cp -ap docs "$HOME/tmp/project" &&
+
 cd "$HOME/tmp/project" &&
+chmod -R u=rwX,go=rX docs &&
+
 python setup.py sdist --formats=bztar &&
 cd dist && mv project-*.tar.bz2 ../.. && cd ../.. && exec rm -rf project
diff --git a/project_template/publish-docs b/project_template/publish-docs
new file mode 100755 (executable)
index 0000000..6e52773
--- /dev/null
@@ -0,0 +1,8 @@
+#! /bin/sh
+
+web="$HOME"/Internet/WWW/htdocs/phdru.name/Software/Python/project/docs
+
+cd "`dirname \"$0\"`"/docs/_build/html &&
+rsync -ahP --del * --exclude=objects.inv "$web" &&
+
+exec chmod -R u=rwX,go=rX "$web"
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..beed0554c1dee36c62ce934bb621461b246e7c4a 100644 (file)
@@ -0,0 +1,4 @@
+--trusted-host phdru.name
+--find-links=http://phdru.name/Software/Python/
+--install-option="--compile"
+
index bc172400dbde21f55d8ec9c34ee7afcf0a2e269d..1872c407f00d02299caaccbf0c49a905a1b75786 100644 (file)
@@ -2,6 +2,14 @@
 universal = 1
 
 [easy_install]
+find_links = http://phdru.name/Software/Python/
+optimize = 2
+
+[egg_info]
+tag_build = 
+tag_date = 0
+tag_svn_revision = 0
 
 [flake8]
-exclude = .git
+exclude = .git,docs/conf.py
+
index 3c7dc16a007180448698180a19c68d1d0a722da6..ba44c7483f4ba462a2c5edf794dee1f7f7c578e0 100755 (executable)
@@ -16,8 +16,8 @@ except ImportError:
     is_setuptools = False
 
 versionpath = join(abspath(dirname(__file__)), 'project', '__version__.py')
-load_source('m_librarian_version', versionpath)
-from m_librarian_version import __version__
+load_source('project_version', versionpath)
+from project_version import __version__
 
 setup(name='Template project',
       version=__version__,
diff --git a/project_template/tests/Makefile b/project_template/tests/Makefile
new file mode 100644 (file)
index 0000000..b990065
--- /dev/null
@@ -0,0 +1,4 @@
+
+.PHONY: all
+all:
+       ./run_all.py
diff --git a/project_template/tests/__init__.py b/project_template/tests/__init__.py
new file mode 100644 (file)
index 0000000..3c09ede
--- /dev/null
@@ -0,0 +1,22 @@
+
+import unittest
+
+__all__ = ['TestCase', 'main']
+
+
+class TestCase(unittest.TestCase):
+    def setUp(self):
+        pass
+
+    def tearDown(self):
+        pass
+
+
+def main():
+    try:
+        unittest.main(testRunner=unittest.TextTestRunner())
+    except SystemExit, msg:
+        result = msg.args[0]
+    else:
+        result = 0
+    raise SystemExit(result)
diff --git a/project_template/tests/run_all.py b/project_template/tests/run_all.py
new file mode 100755 (executable)
index 0000000..2e217bf
--- /dev/null
@@ -0,0 +1,38 @@
+#! /usr/bin/env python
+
+
+import os
+import sys
+import subprocess
+
+
+def isexecutable(filename):
+    infile = open(filename, 'r')
+    magic = infile.read(2)
+    infile.close()
+    return magic == "#!"
+
+
+def collect_tests():
+    tests = []
+    for dirpath, dirs, files in os.walk("tests"):
+        tests.extend(
+            [os.path.join(dirpath, filename) for filename in files
+             if filename.startswith("test") and filename.endswith(".py")
+             ])
+    return [test[:-3].replace(os.sep, '.') for test in tests
+            if isexecutable(test)]
+
+
+def main():
+    os.chdir(os.path.join(os.path.dirname(sys.argv[0]), os.pardir))
+    tests = collect_tests()
+
+    os.environ["PYTHONPATH"] = os.curdir
+
+    for test in sorted(tests):
+        print test
+        subprocess.call((sys.executable, '-m', test))
+
+if __name__ == '__main__':
+    main()
diff --git a/project_template/tests/test_test.py b/project_template/tests/test_test.py
new file mode 100755 (executable)
index 0000000..422d67d
--- /dev/null
@@ -0,0 +1,14 @@
+#! /usr/bin/env python
+
+
+import unittest
+from tests import main
+
+
+class TestFormat(unittest.TestCase):
+    def test_test(self):
+        self.assertEqual()
+
+
+if __name__ == "__main__":
+    main()
diff --git a/project_template/update b/project_template/update
new file mode 100755 (executable)
index 0000000..690ecaa
--- /dev/null
@@ -0,0 +1,2 @@
+#! /bin/sh
+exec "$HOME"/admin/prog/git-scripts/update