Browse Source

Force consistent ordering of the datadir

pull/120/head
Oliverpool 9 years ago
parent
commit
88d97971d3
  1. 6
      patacrep/content/song.py
  2. 54
      test/test_compilation/subdir.tex.control

6
patacrep/content/song.py

@ -46,6 +46,10 @@ class SongRenderer(Content):
song=self.song.render(output=context['filename']), song=self.song.render(output=context['filename']),
) )
def __lt__(self, other):
"""Order by song path"""
return self.song.fullpath < other.song.fullpath
#pylint: disable=unused-argument #pylint: disable=unused-argument
def parse(keyword, argument, contentlist, config): def parse(keyword, argument, contentlist, config):
"""Parse data associated with keyword 'song'. """Parse data associated with keyword 'song'.
@ -102,7 +106,7 @@ def parse(keyword, argument, contentlist, config):
[item.fullpath for item in config['_songdir']], [item.fullpath for item in config['_songdir']],
message='Ignoring "{name}": did not match any file in {paths}.', message='Ignoring "{name}": did not match any file in {paths}.',
)) ))
return songlist return sorted(songlist)
CONTENT_PLUGINS = {'song': parse} CONTENT_PLUGINS = {'song': parse}

54
test/test_compilation/subdir.tex.control

@ -93,23 +93,28 @@ guitar,
\begin{songs}{titleidx,authidx} \begin{songs}{titleidx,authidx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% songs/./datadir2.sgc %% songs/./datadir.sg
\selectlanguage{french} \import{subdir_datadir/songs/}{datadir.sg}
\beginsong{Image included from a different datadir\\ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% songs/./datadir.sgc
\selectlanguage{english}
\beginsong{Image included from datadir\\
Chordpro}[ Chordpro}[
by={ by={
}, },
cov={img/datadir2.png}, cov={img/datadir.png},
] ]
\cover \cover
\lilypond{scores/datadir2.ly} \lilypond{scores/datadir.ly}
\image{img/datadir2.png} \image{img/datadir.png}
\endsong \endsong
@ -120,59 +125,54 @@ Chordpro}[
\import{subdir_datadir/songs/}{datadir2.sg} \import{subdir_datadir/songs/}{datadir2.sg}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% songs/./relative.sgc %% songs/./datadir2.sgc
\selectlanguage{french} \selectlanguage{french}
\beginsong{Image included from song directory\\ \beginsong{Image included from a different datadir\\
Chordpro}[ Chordpro}[
by={ by={
}, },
cov={/home/louis/projets/patacrep/patacrep/test/test_compilation/subdir_datadir/songs/relative.png}, cov={img/datadir2.png},
] ]
\cover \cover
\lilypond{/home/louis/projets/patacrep/patacrep/test/test_compilation/subdir_datadir/songs/relative.ly} \lilypond{scores/datadir2.ly}
\image{/home/louis/projets/patacrep/patacrep/test/test_compilation/subdir_datadir/songs/relative.png} \image{img/datadir2.png}
\endsong \endsong
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% songs/./datadir.sgc %% songs/./relative.sg
\selectlanguage{english} \import{subdir_datadir/songs/}{relative.sg}
\beginsong{Image included from datadir\\ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% songs/./relative.sgc
\selectlanguage{french}
\beginsong{Image included from song directory\\
Chordpro}[ Chordpro}[
by={ by={
}, },
cov={img/datadir.png}, cov={/home/louis/projets/patacrep/patacrep/test/test_compilation/subdir_datadir/songs/relative.png},
] ]
\cover \cover
\lilypond{scores/datadir.ly} \lilypond{/home/louis/projets/patacrep/patacrep/test/test_compilation/subdir_datadir/songs/relative.ly}
\image{img/datadir.png} \image{/home/louis/projets/patacrep/patacrep/test/test_compilation/subdir_datadir/songs/relative.png}
\endsong \endsong
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% songs/./relative.sg
\import{subdir_datadir/songs/}{relative.sg}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% songs/./datadir.sg
\import{subdir_datadir/songs/}{datadir.sg}
\end{songs} \end{songs}

Loading…
Cancel
Save