mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-04 22:40:29 +03:00
yml srclibs: support Subdir as list
This commit is contained in:
parent
1ac7d612b1
commit
5741e6930b
2 changed files with 44 additions and 1 deletions
|
|
@ -778,7 +778,12 @@ def parse_yml_srclib(metadatapath):
|
||||||
return thisinfo
|
return thisinfo
|
||||||
else:
|
else:
|
||||||
if key == 'Subdir':
|
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):
|
elif key == 'Prepare' and isinstance(data[key], list):
|
||||||
thisinfo[key] = ' && '.join(data[key])
|
thisinfo[key] = ' && '.join(data[key])
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -733,6 +733,44 @@ 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_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):
|
def test_read_srclibs_yml_prepare_list(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