mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-20 13:50:12 +01:00
yml srclibs: support Subdir as list
This commit is contained in:
parent
1ac7d612b1
commit
5741e6930b
@ -778,7 +778,12 @@ def parse_yml_srclib(metadatapath):
|
||||
return thisinfo
|
||||
else:
|
||||
if key == 'Subdir':
|
||||
thisinfo[key] = str(data[key] or '').split(',')
|
||||
if isinstance(data[key], str):
|
||||
thisinfo[key] = data[key].split(',')
|
||||
elif isinstance(data[key], list):
|
||||
thisinfo[key] = data[key]
|
||||
elif data[key] is None:
|
||||
thisinfo[key] = ['']
|
||||
elif key == 'Prepare' and isinstance(data[key], list):
|
||||
thisinfo[key] = ' && '.join(data[key])
|
||||
else:
|
||||
|
@ -733,6 +733,44 @@ class MetadataTest(unittest.TestCase):
|
||||
"ant.properties && echo -e "
|
||||
"'android.library=true\\ntarget=android-19' > project.properties"})
|
||||
|
||||
def test_read_srclibs_yml_subdir_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:
|
||||
- This is your last chance.
|
||||
- After this, there is no turning back.
|
||||
- You take the blue pill—the story ends,
|
||||
- you wake up in your bed
|
||||
- and believe whatever you want to believe.
|
||||
- You take the red pill—you stay in Wonderland
|
||||
- and I show you how deep the rabbit-hole goes.
|
||||
Prepare:
|
||||
There is a difference between knowing the path
|
||||
and walking the path.
|
||||
'''))
|
||||
fdroidserver.metadata.read_srclibs()
|
||||
self.maxDiff = None
|
||||
self.assertDictEqual(fdroidserver.metadata.srclibs,
|
||||
{'with-list': {'RepoType': 'git',
|
||||
'Repo': 'https://git.host/repo.git',
|
||||
'Subdir': ['This is your last chance.',
|
||||
'After this, there is no turning back.',
|
||||
'You take the blue pill—the story ends,',
|
||||
'you wake up in your bed',
|
||||
'and believe whatever you want to believe.',
|
||||
'You take the red pill—you stay in Wonderland',
|
||||
'and I show you how deep the rabbit-hole goes.'],
|
||||
'Prepare': 'There is a difference between knowing the path '
|
||||
'and walking the path.'}})
|
||||
|
||||
def test_read_srclibs_yml_prepare_list(self):
|
||||
fdroidserver.metadata.warnings_action = 'error'
|
||||
fdroidserver.metadata.srclibs = None
|
||||
|
Loading…
Reference in New Issue
Block a user