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']),
)
def __lt__(self, other):
"""Order by song path"""
return self.song.fullpath < other.song.fullpath
#pylint: disable=unused-argument
def parse(keyword, argument, contentlist, config):
"""Parse data associated with keyword 'song'.
@ -102,7 +106,7 @@ def parse(keyword, argument, contentlist, config):
[item.fullpath for item in config['_songdir']],
message='Ignoring "{name}": did not match any file in {paths}.',
))
return songlist
return sorted(songlist)
CONTENT_PLUGINS = {'song': parse}

54
test/test_compilation/subdir.tex.control

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

Loading…
Cancel
Save