Browse Source

Merge branch 'chordpro' of github.com:patacrep/patacrep into chordpro

Conflicts:
	patacrep/content/__init__.py
	patacrep/content/song.py
	patacrep/files.py
	patacrep/latex/__init__.py
	patacrep/latex/syntax.py
	patacrep/songs/__init__.py
	patacrep/songs/latex/__init__.py
	setup.py
pull/70/head
Louis 10 years ago
parent
commit
18fee66c9c
  1. 2
      MANIFEST.in
  2. 63
      README.rst
  3. 3
      patacrep/build.py
  4. 9
      patacrep/content/song.py
  5. 9
      patacrep/files.py
  6. 7
      patacrep/songs/__init__.py
  7. 4
      patacrep/songs/chordpro/__init__.py
  8. 61
      readme.md
  9. 2
      setup.py

2
MANIFEST.in

@ -1,2 +0,0 @@
include LICENSE NEWS readme.md Requirements.txt
recursive-include patacrep/data *

63
README.rst

@ -0,0 +1,63 @@
Patacrep, a songbook compilation chain
======================================
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
guitar tabs or lilypond sheets.
Document are subject to the GNU GPLv2 except if another licence
is precised in the header.
Python version
--------------
Patacrep is only compatible with Python > 3.3.
Installation
------------
Using pip
^^^^^^^^^
As simple as::
pip3 install patacrep
For developement
^^^^^^^^^^^^^^^^
Clone Patacrep repos::
git clone git://github.com/patacrep/patacrep.git
cd patacrep
pip3 install -r Requirements.txt
python3 setup.py install
Quick and dirty Debian (and Ubuntu?) package
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This requires `stdeb <https://github.com/astraw/stdeb>`_ to be installed::
python setup.py --command-packages=stdeb.command bdist_deb
sudo dpkg -i deb_dist/python3-patacrep_4.0.0-1_all.deb
Run
---
::
songbook <songbook_file.sb>
<pdfreader> <songbook_file.pdf>
Look for existing songbook files in `patadata <http://github.com/patacrep/patadata>`_.
More informations
-----------------
The full documentation is hosted by readthedoc, here : http://patacrep.readthedocs.org/.
Contact & Forums
----------------
* http://www.patacrep.com/forum

3
patacrep/build.py

@ -219,8 +219,9 @@ class SongbookBuilder(object):
stdin=PIPE,
stdout=PIPE,
stderr=PIPE,
env=os.environ,
universal_newlines=True,
env=os.environ)
)
except Exception as error:
LOGGER.debug(error)
raise errors.LatexCompilationError(self.basename)

9
patacrep/content/song.py

@ -57,7 +57,6 @@ def parse(keyword, argument, contentlist, config):
if contentlist:
break
contentlist = files.recursive_find(songdir.fullpath, plugins.keys())
for elem in contentlist:
before = len(songlist)
for songdir in config['_songdir']:
@ -65,16 +64,16 @@ def parse(keyword, argument, contentlist, config):
continue
with files.chdir(songdir.datadir):
for filename in glob.iglob(os.path.join(songdir.subpath, elem)):
LOGGER.debug('Parsing file "{}"'.format(filename))
extension = filename.split(".")[-1]
if extension not in plugins:
LOGGER.warning((
'I do not know how to parse "{}". Ignored.'
LOGGER.warning(
'File "{}" does not end with one of {}. Ignored.'
).format(
os.path.join(songdir.datadir, filename),
", ".join(["'.{}'".format(key) for key in plugins.keys()]),
)
)
continue
LOGGER.debug('Parsing file "{}"'.format(filename))
renderer = SongRenderer(plugins[extension](
songdir.datadir,
filename,

9
patacrep/files.py

@ -1,6 +1,7 @@
"""File system utilities."""
from contextlib import contextmanager
import fnmatch
import importlib
import logging
import os
@ -10,13 +11,9 @@ import re
LOGGER = logging.getLogger(__name__)
def recursive_find(root_directory, extensions):
"""Recursively find files with some extension, from a root_directory.
"""Recursively find files with the given extensions, from a root_directory.
Return a list of files matching those conditions.
Arguments:
- `extensions`: list of accepted extensions.
- `root_directory`: root directory of the search.
Return a list of files ending with one of the given extensions.
"""
if not os.path.isdir(root_directory):
return []

7
patacrep/songs/__init__.py

@ -96,10 +96,17 @@ class Song(Content):
"_version",
]
# Default data
DEFAULT_DATA = {
'@titles': [],
'@languages': [],
}
def __init__(self, datadir, subpath, config):
self.fullpath = os.path.join(datadir, subpath)
self.datadir = datadir
self.encoding = config["encoding"]
self.config = config
if datadir:
# Only songs in datadirs are cached

4
patacrep/songs/chordpro/__init__.py

@ -23,12 +23,10 @@ class ChordproSong(Song):
self.cached = {
'song': song,
}
#: Main language
self.language = song.get_directive('language', config['lang'])
def tex(self, output):
context = {
'language': self.language,
'language': self.cached['song'].get_directive('language', self.config['lang']),
'columns': self.cached['song'].get_directive('columns', 1),
"path": files.relpath(self.fullpath, os.path.dirname(output)),
"titles": r"\\".join(self.titles),

61
readme.md

@ -1,61 +0,0 @@
# Patacrep, a songbook compilation chain
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
guitar tabs or lilypond sheets.
Document are subject to the GNU GPLv2 except if another licence
is precised in the header.
# Python version
Patacrep is only compatible with Python > 3.3.
# Installation
## Using pip
As simple as
```
pip3 install patacrep
```
## For developement
Clone Patacrep repos:
```
git clone git://github.com/patacrep/patacrep.git
cd patacrep
pip3 install -r Requirements.txt
python3 setup.py install
```
## Quick and dirty Debian (and Ubuntu?) package
This requires [stdeb](https://github.com/astraw/stdeb) to be installed.
```
python setup.py --command-packages=stdeb.command bdist_deb
sudo dpkg -i deb_dist/python3-patacrep_4.0.0-1_all.deb
```
# Run
```
songbook <songbook_file.sb>
<pdfreader> <songbook_file.pdf>
```
Look for existing songbook files in [patadata](http://github.com/patacrep/patadata)
# More informations
The full documentation is hosted by readthedoc, here : http://patacrep.readthedocs.org/
# Contact & Forums
* http://www.patacrep.com/forum

2
setup.py

@ -20,6 +20,7 @@ setup(
install_requires=[
"unidecode", "jinja2", "chardet", "ply",
],
setup_requires=["hgtools"],
include_package_data=True,
entry_points={
'console_scripts': [
@ -39,4 +40,5 @@ setup(
],
platforms=["GNU/Linux", "Windows", "MacOsX"],
test_suite="patacrep.test.suite",
long_description = open("README.rst", "r").read(),
)

Loading…
Cancel
Save