From 5d3bbd92f34b1d594787be9792f05363beab7b1d Mon Sep 17 00:00:00 2001 From: Louis Date: Sat, 1 Mar 2014 14:09:48 +0100 Subject: [PATCH] =?UTF-8?q?Mise=20en=20place=20d'un=20installateur,=20et?= =?UTF-8?q?=20d=C3=A9placement=20des=20donn=C3=A9es=20dans=20un=20endroit?= =?UTF-8?q?=20portable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #8 --- .gitignore | 2 + readme.md | 13 ++++++- setup.py | 36 ++++++++++++++++++ songbook | 4 +- songbook_core/__init__.py | 11 ++++-- songbook_core/build.py | 6 +-- {share => songbook_core/data}/examples/README | 0 .../data}/examples/example.sb | 0 .../data}/examples/img/README | 0 .../data}/examples/img/treble_a.png | Bin .../data}/examples/latex/README | 0 .../data}/examples/songs/README | 0 .../data}/examples/songs/_lilypond/header | 0 .../songs/chevaliers_de_la_table_ronde.sg | 0 .../data}/examples/songs/example-en.sg | 0 .../data}/examples/songs/example-fr.sg | 0 .../data}/examples/songs/greensleeves.ly | 0 .../data}/examples/songs/greensleeves.sg | 0 .../data}/examples/songs/traditionnel.jpg | Bin .../data}/examples/songs/vent_frais.sg | 0 .../data}/examples/templates/README | 0 .../data}/latex/chords.sty | 0 .../data}/latex/crepbook.cls | 0 {share => songbook_core/data}/latex/songs.sty | 0 .../data}/latex/venturisold.sty | 0 .../data}/latex/xstring.sty | 0 .../data}/templates/default.tmpl | 0 27 files changed, 62 insertions(+), 10 deletions(-) create mode 100644 setup.py rename {share => songbook_core/data}/examples/README (100%) rename {share => songbook_core/data}/examples/example.sb (100%) rename {share => songbook_core/data}/examples/img/README (100%) rename {share => songbook_core/data}/examples/img/treble_a.png (100%) rename {share => songbook_core/data}/examples/latex/README (100%) rename {share => songbook_core/data}/examples/songs/README (100%) rename {share => songbook_core/data}/examples/songs/_lilypond/header (100%) rename {share => songbook_core/data}/examples/songs/chevaliers_de_la_table_ronde.sg (100%) rename {share => songbook_core/data}/examples/songs/example-en.sg (100%) rename {share => songbook_core/data}/examples/songs/example-fr.sg (100%) rename {share => songbook_core/data}/examples/songs/greensleeves.ly (100%) rename {share => songbook_core/data}/examples/songs/greensleeves.sg (100%) rename {share => songbook_core/data}/examples/songs/traditionnel.jpg (100%) rename {share => songbook_core/data}/examples/songs/vent_frais.sg (100%) rename {share => songbook_core/data}/examples/templates/README (100%) rename {share => songbook_core/data}/latex/chords.sty (100%) rename {share => songbook_core/data}/latex/crepbook.cls (100%) rename {share => songbook_core/data}/latex/songs.sty (100%) rename {share => songbook_core/data}/latex/venturisold.sty (100%) rename {share => songbook_core/data}/latex/xstring.sty (100%) rename {share => songbook_core/data}/templates/default.tmpl (100%) diff --git a/.gitignore b/.gitignore index 3bcf8958..18533c63 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +deb_dist +build .gitignore *~ *.aux diff --git a/readme.md b/readme.md index 55a97355..502056fa 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,7 @@ Songbook Compilation Chain # Description + This package provides a compilation toolchain that produce LaTeX songbook using the LaTeX songs package. A new LaTeX document class is provided to allow specific customisation and new command like embedded @@ -13,7 +14,9 @@ to the CC-BY-SA licence. Other document are subject to the GNU GPLv2 except if another licence is precised in the header. -# Clone Patacrep repos +# Download + +Clone Patacrep repos: > git clone git://github.com/crep4ever/songbook-core.git > git clone git://github.com/crep4ever/songbook-data.git @@ -28,10 +31,18 @@ Look for existing songbook files in /books. For example: > /songbook /books/songbook_en.sb > songbook_en.pdf +# Quick and dirty deb packages + +Install `python-stdeb`, then: + +> python setup.py --command-packages=stdeb.command bdist_deb +> sudo dpkg -i deb_dist/python-songbook-core_-1_all.deb # Documentation + http://www.patacrep.com/data/documents/doc_en.pdf # Contact & Forums + * http://www.patacrep.com * crep@team-on-fire.com diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..1568b25b --- /dev/null +++ b/setup.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +"""Installation script for songbook. + +$ python setup.py install +""" + +from distutils.core import setup + +import songbook_core + +setup(name='songbook-core', + version=songbook_core.__STR_VERSION__, + description='Songbook compilation chain', + author='The Songbook team', + author_email='crep@team-on-fire.com', + url='https://github.com/patacrep/songbook-core', + scripts=['songbook'], + license="GPLv2 or any later version", + requires=[ + "argparse", "codecs", "distutils", "fnmatch", "glob", "json", + "locale", "logging", "os", "plasTeX", "re", "subprocess", "sys", + "textwrap", "unidecode" + ], + packages=['songbook_core'], + package_data={'songbook_core': ['*', '*/*', '*/*/*']}, + classifiers=[ + "Environment :: Console", + "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", + "Natural Language :: English", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 2.7", + "Topic :: Utilities", + ], + platforms=["GNU/Linux"], +) diff --git a/songbook b/songbook index 43b0d7ce..9e5e3083 100755 --- a/songbook +++ b/songbook @@ -13,7 +13,7 @@ import textwrap import sys from songbook_core.build import buildsongbook -from songbook_core import __VERSION__ +from songbook_core import __STR_VERSION__ from songbook_core import errors @@ -22,7 +22,7 @@ def argument_parser(args): parser = argparse.ArgumentParser(description="A song book compiler") parser.add_argument('--version', help='Show version', action='version', - version='%(prog)s ' + __VERSION__) + version='%(prog)s ' + __STR_VERSION__) parser.add_argument('book', nargs=1, help=textwrap.dedent("""\ Book to compile. diff --git a/songbook_core/__init__.py b/songbook_core/__init__.py index b580af8b..96f0724e 100644 --- a/songbook_core/__init__.py +++ b/songbook_core/__init__.py @@ -1,11 +1,14 @@ """Global variables.""" +from pkg_resources import resource_filename import os -__VERSION__ = "3.7.2" +# Version + +__VERSION__ = (3, 7, 2) +__STR_VERSION__ = '.'.join([str(number) for number in __VERSION__]) # Directory containing shared data (default templates, custom LaTeX packages, # etc.) -__SHAREDIR__ = os.path.abspath( - os.path.join(os.path.dirname(__file__), "..", "share") - ) + +__DATADIR__ = os.path.abspath(resource_filename(__name__, 'data')) diff --git a/songbook_core/build.py b/songbook_core/build.py index c27dc9e1..e7673f70 100755 --- a/songbook_core/build.py +++ b/songbook_core/build.py @@ -11,7 +11,7 @@ import os.path import re import subprocess -from songbook_core import __SHAREDIR__ +from songbook_core import __DATADIR__ from songbook_core import errors from songbook_core.files import recursive_find from songbook_core.index import process_sxd @@ -127,7 +127,7 @@ def make_tex_file(songbook, output): template = songbook["template"] del songbook["template"] else: - template = os.path.join(__SHAREDIR__, "templates", "default.tmpl") + template = os.path.join(__DATADIR__, "templates", "default.tmpl") if "songs" in songbook: songs = songbook["songs"] del songbook["songs"] @@ -256,7 +256,7 @@ def buildsongbook( if not 'TEXINPUTS' in os.environ.keys(): os.environ['TEXINPUTS'] = '' os.environ['TEXINPUTS'] += os.pathsep + os.path.join( - __SHAREDIR__, + __DATADIR__, 'latex', ) os.environ['TEXINPUTS'] += os.pathsep + os.path.join( diff --git a/share/examples/README b/songbook_core/data/examples/README similarity index 100% rename from share/examples/README rename to songbook_core/data/examples/README diff --git a/share/examples/example.sb b/songbook_core/data/examples/example.sb similarity index 100% rename from share/examples/example.sb rename to songbook_core/data/examples/example.sb diff --git a/share/examples/img/README b/songbook_core/data/examples/img/README similarity index 100% rename from share/examples/img/README rename to songbook_core/data/examples/img/README diff --git a/share/examples/img/treble_a.png b/songbook_core/data/examples/img/treble_a.png similarity index 100% rename from share/examples/img/treble_a.png rename to songbook_core/data/examples/img/treble_a.png diff --git a/share/examples/latex/README b/songbook_core/data/examples/latex/README similarity index 100% rename from share/examples/latex/README rename to songbook_core/data/examples/latex/README diff --git a/share/examples/songs/README b/songbook_core/data/examples/songs/README similarity index 100% rename from share/examples/songs/README rename to songbook_core/data/examples/songs/README diff --git a/share/examples/songs/_lilypond/header b/songbook_core/data/examples/songs/_lilypond/header similarity index 100% rename from share/examples/songs/_lilypond/header rename to songbook_core/data/examples/songs/_lilypond/header diff --git a/share/examples/songs/chevaliers_de_la_table_ronde.sg b/songbook_core/data/examples/songs/chevaliers_de_la_table_ronde.sg similarity index 100% rename from share/examples/songs/chevaliers_de_la_table_ronde.sg rename to songbook_core/data/examples/songs/chevaliers_de_la_table_ronde.sg diff --git a/share/examples/songs/example-en.sg b/songbook_core/data/examples/songs/example-en.sg similarity index 100% rename from share/examples/songs/example-en.sg rename to songbook_core/data/examples/songs/example-en.sg diff --git a/share/examples/songs/example-fr.sg b/songbook_core/data/examples/songs/example-fr.sg similarity index 100% rename from share/examples/songs/example-fr.sg rename to songbook_core/data/examples/songs/example-fr.sg diff --git a/share/examples/songs/greensleeves.ly b/songbook_core/data/examples/songs/greensleeves.ly similarity index 100% rename from share/examples/songs/greensleeves.ly rename to songbook_core/data/examples/songs/greensleeves.ly diff --git a/share/examples/songs/greensleeves.sg b/songbook_core/data/examples/songs/greensleeves.sg similarity index 100% rename from share/examples/songs/greensleeves.sg rename to songbook_core/data/examples/songs/greensleeves.sg diff --git a/share/examples/songs/traditionnel.jpg b/songbook_core/data/examples/songs/traditionnel.jpg similarity index 100% rename from share/examples/songs/traditionnel.jpg rename to songbook_core/data/examples/songs/traditionnel.jpg diff --git a/share/examples/songs/vent_frais.sg b/songbook_core/data/examples/songs/vent_frais.sg similarity index 100% rename from share/examples/songs/vent_frais.sg rename to songbook_core/data/examples/songs/vent_frais.sg diff --git a/share/examples/templates/README b/songbook_core/data/examples/templates/README similarity index 100% rename from share/examples/templates/README rename to songbook_core/data/examples/templates/README diff --git a/share/latex/chords.sty b/songbook_core/data/latex/chords.sty similarity index 100% rename from share/latex/chords.sty rename to songbook_core/data/latex/chords.sty diff --git a/share/latex/crepbook.cls b/songbook_core/data/latex/crepbook.cls similarity index 100% rename from share/latex/crepbook.cls rename to songbook_core/data/latex/crepbook.cls diff --git a/share/latex/songs.sty b/songbook_core/data/latex/songs.sty similarity index 100% rename from share/latex/songs.sty rename to songbook_core/data/latex/songs.sty diff --git a/share/latex/venturisold.sty b/songbook_core/data/latex/venturisold.sty similarity index 100% rename from share/latex/venturisold.sty rename to songbook_core/data/latex/venturisold.sty diff --git a/share/latex/xstring.sty b/songbook_core/data/latex/xstring.sty similarity index 100% rename from share/latex/xstring.sty rename to songbook_core/data/latex/xstring.sty diff --git a/share/templates/default.tmpl b/songbook_core/data/templates/default.tmpl similarity index 100% rename from share/templates/default.tmpl rename to songbook_core/data/templates/default.tmpl