mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-04 22:40:29 +03:00
yml srclibs: support multiline Prepare
This commit is contained in:
parent
58776da694
commit
1ac7d612b1
2 changed files with 39 additions and 0 deletions
|
|
@ -779,6 +779,8 @@ def parse_yml_srclib(metadatapath):
|
||||||
else:
|
else:
|
||||||
if key == 'Subdir':
|
if key == 'Subdir':
|
||||||
thisinfo[key] = str(data[key] or '').split(',')
|
thisinfo[key] = str(data[key] or '').split(',')
|
||||||
|
elif key == 'Prepare' and isinstance(data[key], list):
|
||||||
|
thisinfo[key] = ' && '.join(data[key])
|
||||||
else:
|
else:
|
||||||
thisinfo[key] = str(data[key] or '')
|
thisinfo[key] = str(data[key] or '')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -733,6 +733,43 @@ class MetadataTest(unittest.TestCase):
|
||||||
"ant.properties && echo -e "
|
"ant.properties && echo -e "
|
||||||
"'android.library=true\\ntarget=android-19' > project.properties"})
|
"'android.library=true\\ntarget=android-19' > project.properties"})
|
||||||
|
|
||||||
|
def test_read_srclibs_yml_prepare_list(self):
|
||||||
|
fdroidserver.metadata.warnings_action = 'error'
|
||||||
|
fdroidserver.metadata.srclibs = None
|
||||||
|
with tempfile.TemporaryDirectory() as tmpdir, TmpCwd(tmpdir):
|
||||||
|
os.mkdir('srclibs')
|
||||||
|
with open('srclibs/with-list.yml', 'w', encoding='utf-8') as f:
|
||||||
|
f.write(textwrap.dedent('''\
|
||||||
|
# this should be simple
|
||||||
|
RepoType: git
|
||||||
|
Repo: https://git.host/repo.git
|
||||||
|
|
||||||
|
Subdir:
|
||||||
|
Prepare:
|
||||||
|
- The Matrix is a system, Neo.
|
||||||
|
- That system is our enemy.
|
||||||
|
- But when you're inside, you look around, what do you see?
|
||||||
|
- Businessmen, teachers, lawyers, carpenters.
|
||||||
|
- The very minds of the people we are trying to save.
|
||||||
|
- But until we do, these people are still a part of that system and that makes them our enemy.
|
||||||
|
- You have to understand, most of these people are not ready to be unplugged.
|
||||||
|
- And many of them are so inert, so hopelessly dependent on the system that they will fight to protect it.
|
||||||
|
'''))
|
||||||
|
fdroidserver.metadata.read_srclibs()
|
||||||
|
self.maxDiff = None
|
||||||
|
self.assertDictEqual(fdroidserver.metadata.srclibs,
|
||||||
|
{'with-list': {'RepoType': 'git',
|
||||||
|
'Repo': 'https://git.host/repo.git',
|
||||||
|
'Subdir': [''],
|
||||||
|
'Prepare': 'The Matrix is a system, Neo. && '
|
||||||
|
'That system is our enemy. && '
|
||||||
|
'But when you\'re inside, you look around, what do you see? && '
|
||||||
|
'Businessmen, teachers, lawyers, carpenters. && '
|
||||||
|
'The very minds of the people we are trying to save. && '
|
||||||
|
'But until we do, these people are still a part of that system and that makes them our enemy. && '
|
||||||
|
'You have to understand, most of these people are not ready to be unplugged. && '
|
||||||
|
'And many of them are so inert, so hopelessly dependent on the system that they will fight to protect it.'}})
|
||||||
|
|
||||||
def test_read_srclibs(self):
|
def test_read_srclibs(self):
|
||||||
fdroidserver.metadata.warnings_action = 'error'
|
fdroidserver.metadata.warnings_action = 'error'
|
||||||
fdroidserver.metadata.srclibs = None
|
fdroidserver.metadata.srclibs = None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue