From 0b99b8f1ff0bb79748800695e0d6524408e98406 Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 17 Feb 2014 14:07:12 +0100 Subject: [PATCH] =?UTF-8?q?Cr=C3=A9ation=20d'un=20r=C3=A9pertoire=20SHARE,?= =?UTF-8?q?=20qui=20contient=20des=20donn=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {examples => share/examples}/README | 0 {examples => share/examples}/example.sb | 1 - {examples => share/examples}/img/README | 0 {examples => share/examples}/img/treble_a.png | Bin {examples => share/examples}/latex/README | 0 {examples => share/examples}/songs/README | 0 {examples => share/examples}/songs/_lilypond/header | 0 .../examples}/songs/chevaliers_de_la_table_ronde.sg | 0 {examples => share/examples}/songs/example-en.sg | 0 {examples => share/examples}/songs/example-fr.sg | 0 {examples => share/examples}/songs/greensleeves.ly | 0 {examples => share/examples}/songs/greensleeves.sg | 0 {examples => share/examples}/songs/traditionnel.jpg | Bin {examples => share/examples}/songs/vent_frais.sg | 0 {examples => share/examples}/templates/README | 0 {latex => share/latex}/chords.sty | 0 {latex => share/latex}/crepbook.cls | 0 {latex => share/latex}/songs.sty | 0 {latex => share/latex}/venturisold.sty | 0 {latex => share/latex}/xstring.sty | 0 {examples => share}/templates/default.tmpl | 8 ++++---- songbook/__init__.py | 5 +++++ songbook/build.py | 7 ++++--- 23 files changed, 13 insertions(+), 8 deletions(-) rename {examples => share/examples}/README (100%) rename {examples => share/examples}/example.sb (88%) rename {examples => share/examples}/img/README (100%) rename {examples => share/examples}/img/treble_a.png (100%) rename {examples => share/examples}/latex/README (100%) rename {examples => share/examples}/songs/README (100%) rename {examples => share/examples}/songs/_lilypond/header (100%) rename {examples => share/examples}/songs/chevaliers_de_la_table_ronde.sg (100%) rename {examples => share/examples}/songs/example-en.sg (100%) rename {examples => share/examples}/songs/example-fr.sg (100%) rename {examples => share/examples}/songs/greensleeves.ly (100%) rename {examples => share/examples}/songs/greensleeves.sg (100%) rename {examples => share/examples}/songs/traditionnel.jpg (100%) rename {examples => share/examples}/songs/vent_frais.sg (100%) rename {examples => share/examples}/templates/README (100%) rename {latex => share/latex}/chords.sty (100%) rename {latex => share/latex}/crepbook.cls (100%) rename {latex => share/latex}/songs.sty (100%) rename {latex => share/latex}/venturisold.sty (100%) rename {latex => share/latex}/xstring.sty (100%) rename {examples => share}/templates/default.tmpl (94%) diff --git a/examples/README b/share/examples/README similarity index 100% rename from examples/README rename to share/examples/README diff --git a/examples/example.sb b/share/examples/example.sb similarity index 88% rename from examples/example.sb rename to share/examples/example.sb index 4b9b0a26..65a601a5 100644 --- a/examples/example.sb +++ b/share/examples/example.sb @@ -1,5 +1,4 @@ { -"template" : "default.tmpl", "bookoptions" : [ "importantdiagramonly", "repeatchords", diff --git a/examples/img/README b/share/examples/img/README similarity index 100% rename from examples/img/README rename to share/examples/img/README diff --git a/examples/img/treble_a.png b/share/examples/img/treble_a.png similarity index 100% rename from examples/img/treble_a.png rename to share/examples/img/treble_a.png diff --git a/examples/latex/README b/share/examples/latex/README similarity index 100% rename from examples/latex/README rename to share/examples/latex/README diff --git a/examples/songs/README b/share/examples/songs/README similarity index 100% rename from examples/songs/README rename to share/examples/songs/README diff --git a/examples/songs/_lilypond/header b/share/examples/songs/_lilypond/header similarity index 100% rename from examples/songs/_lilypond/header rename to share/examples/songs/_lilypond/header diff --git a/examples/songs/chevaliers_de_la_table_ronde.sg b/share/examples/songs/chevaliers_de_la_table_ronde.sg similarity index 100% rename from examples/songs/chevaliers_de_la_table_ronde.sg rename to share/examples/songs/chevaliers_de_la_table_ronde.sg diff --git a/examples/songs/example-en.sg b/share/examples/songs/example-en.sg similarity index 100% rename from examples/songs/example-en.sg rename to share/examples/songs/example-en.sg diff --git a/examples/songs/example-fr.sg b/share/examples/songs/example-fr.sg similarity index 100% rename from examples/songs/example-fr.sg rename to share/examples/songs/example-fr.sg diff --git a/examples/songs/greensleeves.ly b/share/examples/songs/greensleeves.ly similarity index 100% rename from examples/songs/greensleeves.ly rename to share/examples/songs/greensleeves.ly diff --git a/examples/songs/greensleeves.sg b/share/examples/songs/greensleeves.sg similarity index 100% rename from examples/songs/greensleeves.sg rename to share/examples/songs/greensleeves.sg diff --git a/examples/songs/traditionnel.jpg b/share/examples/songs/traditionnel.jpg similarity index 100% rename from examples/songs/traditionnel.jpg rename to share/examples/songs/traditionnel.jpg diff --git a/examples/songs/vent_frais.sg b/share/examples/songs/vent_frais.sg similarity index 100% rename from examples/songs/vent_frais.sg rename to share/examples/songs/vent_frais.sg diff --git a/examples/templates/README b/share/examples/templates/README similarity index 100% rename from examples/templates/README rename to share/examples/templates/README diff --git a/latex/chords.sty b/share/latex/chords.sty similarity index 100% rename from latex/chords.sty rename to share/latex/chords.sty diff --git a/latex/crepbook.cls b/share/latex/crepbook.cls similarity index 100% rename from latex/crepbook.cls rename to share/latex/crepbook.cls diff --git a/latex/songs.sty b/share/latex/songs.sty similarity index 100% rename from latex/songs.sty rename to share/latex/songs.sty diff --git a/latex/venturisold.sty b/share/latex/venturisold.sty similarity index 100% rename from latex/venturisold.sty rename to share/latex/venturisold.sty diff --git a/latex/xstring.sty b/share/latex/xstring.sty similarity index 100% rename from latex/xstring.sty rename to share/latex/xstring.sty diff --git a/examples/templates/default.tmpl b/share/templates/default.tmpl similarity index 94% rename from examples/templates/default.tmpl rename to share/templates/default.tmpl index 2b794797..86526092 100644 --- a/examples/templates/default.tmpl +++ b/share/templates/default.tmpl @@ -4,7 +4,7 @@ % This program is free software; you can redistribute it and/or % modify it under the terms of the GNU General Public License % as published by the Free Software Foundation; either version 2 -% of the License, or (at your option) any later nersion. +% of the License, or (at your option) any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,8 +25,8 @@ % Template parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%:[ -%%: {"name":"title", "description":"Title", "default":"Song book example", "mandatory":true}, -%%: {"name":"author", "description":"Author", "default":"The Songbook team (Crep (R. Goffe), Lohrun (A. Dupas), et al.)", "mandatory":true}, +%%: {"name":"title", "description":"Title", "default":"Recueil de chansons pour guitare", "mandatory":true}, +%%: {"name":"author", "description":"Author", "default":"The Songbook Team", "mandatory":true}, %%: {"name":"booktype", "description":"Type", "type":"enum", "values":["chorded","lyric"], "default":"chorded", "mandatory":true}, %%: {"name":"lang", "description":"Language", "default":"english"}, %%: {"name":"instruments", "description":"Instruments", "type":"flag", "values":["guitar","ukulele"], "join":",", "mandatory":true, "default":["guitar"]}, @@ -37,7 +37,7 @@ %%: {"name":"mail", "description":"Email", "default":"crep@team-on-fire.com"}, %%: {"name":"picture", "description":"Picture", "type":"file", "default":"treble_a"}, %%: {"name":"picturecopyright", "description":"Copyright", "default":"Dbolton \\url{http://commons.wikimedia.org/wiki/User:Dbolton}"}, -%%: {"name":"footer", "description":"Footer", "default":""}, +%%: {"name":"footer", "description":"Footer", "default":"\\begin{flushright}Generated using Songbook (\\url{http://www.patacrep.com})\\end{flushright}"}, %%: {"name":"mainfontsize", "description":"Font Size", "type":"font", "default":"10"}, %%: {"name":"songnumberbgcolor", "description":"Number Shade", "type":"color", "default":"#D1E4AE"}, %%: {"name":"notebgcolor", "description":"Note Shade", "type":"color", "default":"#D1E4AE"}, diff --git a/songbook/__init__.py b/songbook/__init__.py index 06474e29..4071a4e2 100644 --- a/songbook/__init__.py +++ b/songbook/__init__.py @@ -1 +1,6 @@ +import os + __VERSION__ = "3.7.2" + +# Directory containing shared data (default templates, custom LaTeX packages, etc.) +__SHAREDIR__ = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "share")) diff --git a/songbook/build.py b/songbook/build.py index 452bd24e..fb235f6b 100755 --- a/songbook/build.py +++ b/songbook/build.py @@ -12,6 +12,7 @@ import sys from songbook.files import recursiveFind from songbook.index import processSXD from songbook.songs import Song, SongsList +from songbook import __SHAREDIR__ def parseTemplate(template): embeddedJsonPattern = re.compile(r"^%%:") @@ -61,8 +62,6 @@ def makeTexFile(sb, output): datadir = sb['datadir'] name = output[:-4] template_dir = os.path.join(datadir, 'templates') - # default value - template = "patacrep.tmpl" songs = [] prefixes_tex = "" @@ -75,6 +74,8 @@ def makeTexFile(sb, output): if "template" in sb: template = sb["template"] del sb["template"] + else: + template = os.path.join(__SHAREDIR__, "templates", "default.tmpl") if "songs" in sb: songs = sb["songs"] del sb["songs"] @@ -179,7 +180,7 @@ def buildsongbook(sb, basename): if not os.environ.has_key('TEXINPUTS'): os.environ['TEXINPUTS'] = '' - os.environ['TEXINPUTS'] += os.pathsep + os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'latex') + os.environ['TEXINPUTS'] += os.pathsep + os.path.join(__SHAREDIR__, 'latex') os.environ['TEXINPUTS'] += os.pathsep + os.path.join(sb['datadir'], 'latex') # First pdflatex pass