Commit 575f6c8b authored by Yuanle Song's avatar Yuanle Song
Browse files

v0.2.0 add "make deb" support; add logger.conf;

- use wheel to support "make deb"
- use private index at apt.yygamedev.com to fetch yygame-utils
parent 63121172
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
(defproject python/lein-template "0.1.0"
(defproject python/lein-template "0.2.0"
  :description "lein template for a python project"
  :url "http://emacsos.com/lein/python"
  :license {:name "Eclipse Public License"
+22 −9
Original line number Diff line number Diff line
@@ -3,7 +3,9 @@
                                             *dir*]]
            [clojure.java.io :as io]
            [clojure.java.shell :as shell]
            [leiningen.core.main :as main]))
            [leiningen.core.main :as main])
  (:import (java.util Calendar)
           (java.text SimpleDateFormat)))

(def render (renderer "python"))

@@ -19,22 +21,33 @@
  "a standard python project with virtualenv, githooks, pep8, pylint etc"
  [name]
  (let [data {:name name
              :sanitized (name-to-path name)}
              :sanitized (name-to-path name)
              :date (let [cal (Calendar/getInstance)]
                      (.format (new SimpleDateFormat "yyyy-MM-dd")
                               (.getTime cal)))}
        plain-files ["Makefile"
                     "requirements.txt"
                     "setup.py"
                     "README.rst"
                     "utils/bootstrap"
                     "utils/build-deb"
                     "utils/install-git-hooks"
                     "utils/trigger-jenkins-build"
                     "deb-scripts/before-install.sh"
                     "deb-scripts/after-install.sh"
                     "deb-scripts/before-remove.sh"
                     "git-hooks/post-commit"
                     "git-hooks/post-merge"
                     "git-hooks/pre-commit"
                     ".gitignore"]
        post-run-commands [["chmod" "-R" "+x" "utils" "git-hooks/"]]]
        empty-files ["{{name}}/__init__.py"]
        post-run-commands [["chmod" "-R" "+x"
                            "utils/" "git-hooks/" "deb-scripts/"]]]
    (main/info "Generating new python project:" name)
    (apply
     ->files
     data
     ["{{name}}/__init__.py" ""]
    (apply ->files data
           (map (fn [f] [f ""]) empty-files))
    (apply ->files data
           ["{{name}}/logger.conf" (render "logger.conf" data)]
           (map (fn [f] [f (render f data)]) plain-files))
    (shell/with-sh-dir *dir*
      (doseq [cmd post-run-commands]
+8 −0
Original line number Diff line number Diff line
@@ -8,8 +8,14 @@ PYTHON = env PYTHONPATH=$(PYTHONPATH) bin/python
default: pylint
build:

run:
	$(PYTHON) {{name}}/main.py
bootstrap:
	@./utils/bootstrap
install: bootstrap
	bin/python setup.py -q install
deb:
	utils/build-deb
check: test
pylint: bootstrap
	$(PEP8) $(PYTHON_MODULES)
@@ -23,6 +29,8 @@ clean:
	find . -name "*.pyc" -type f -exec rm -rf {} \;
full-clean:
	rm -rf local/ lib/ bin/ include/ build/ dist/ {{name}}.egg-info/
	find . -name "__pycache__" -type d -exec rm -rf {} \;
	find . -name "*.pyc" -type f -exec rm -rf {} \;
TAGS:
	etags -R --exclude=static $(PYTHON_MODULES)
update-git-hooks: install-git-hooks-force
+31 −0
Original line number Diff line number Diff line
{{name}}
============================

TODO add brief intro

Installation
------------

To install {{name}}, simply:

.. code-block:: bash

   $ pip install {{name}}


Quick Start
-----------

TODO

Documentation
-------------

TODO

ChangeLog
---------

* v0.1.0 {{date}}

  - initial release
+15 −0
Original line number Diff line number Diff line
#!/bin/sh
set -e

PREFIX=${PREFIX:-/opt/{{name}}}
LOGDIR=${LOGDIR:-/data2/log/{{name}}}
RUN_AS_USER=root

mkdir -p "$LOGDIR"
if [ "$RUN_AS_USER" != root ]; then
	chown -R "$RUN_AS_USER":"$RUN_AS_USER" "$LOGDIR"
fi

make -C "$PREFIX" bootstrap install

# start {{name}} || true
Loading