mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +00:00
build_manifest.py: add type annotations
This commit is contained in:
parent
a080432a32
commit
095c93c62c
1 changed files with 15 additions and 13 deletions
|
@ -4,8 +4,10 @@ import os
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from typing import Dict, Tuple, List
|
||||||
|
|
||||||
GSTREAMER_MODULES = [
|
GSTREAMER_MODULES: List[str] = [
|
||||||
|
# 'orc',
|
||||||
'gst-build',
|
'gst-build',
|
||||||
'gstreamer',
|
'gstreamer',
|
||||||
'gst-plugins-base',
|
'gst-plugins-base',
|
||||||
|
@ -21,7 +23,7 @@ GSTREAMER_MODULES = [
|
||||||
'gst-rtsp-server'
|
'gst-rtsp-server'
|
||||||
]
|
]
|
||||||
|
|
||||||
MANIFEST_TEMPLATE = """<?xml version="1.0" encoding="UTF-8"?>
|
MANIFEST_TEMPLATE: str = """<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<manifest>
|
<manifest>
|
||||||
<remote fetch="%s" name="user"/>
|
<remote fetch="%s" name="user"/>
|
||||||
<remote fetch="https://gitlab.freedesktop.org/gstreamer/" name="gstreamer"/>
|
<remote fetch="https://gitlab.freedesktop.org/gstreamer/" name="gstreamer"/>
|
||||||
|
@ -30,13 +32,13 @@ MANIFEST_TEMPLATE = """<?xml version="1.0" encoding="UTF-8"?>
|
||||||
</manifest>"""
|
</manifest>"""
|
||||||
|
|
||||||
|
|
||||||
def request(path):
|
def request(path: str) -> Dict[str, str]:
|
||||||
gitlab_header = {'JOB_TOKEN': os.environ["CI_JOB_TOKEN"]}
|
gitlab_header: Dict[str, str] = {'JOB_TOKEN': os.environ["CI_JOB_TOKEN"]}
|
||||||
|
|
||||||
return requests.get('https://gitlab.gnome.org/api/v4/' + path, headers=gitlab_header).json()
|
return requests.get('https://gitlab.gnome.org/api/v4/' + path, headers=gitlab_header).json()
|
||||||
|
|
||||||
|
|
||||||
def find_repository_sha(module, branchname):
|
def find_repository_sha(module: str, branchname: str) -> Tuple[str, str]:
|
||||||
for project in request('projects?search=' + module):
|
for project in request('projects?search=' + module):
|
||||||
if project['name'] != module:
|
if project['name'] != module:
|
||||||
continue
|
continue
|
||||||
|
@ -67,19 +69,19 @@ def find_repository_sha(module, branchname):
|
||||||
return 'origin', 'master'
|
return 'origin', 'master'
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
user_namespace = os.environ['CI_PROJECT_NAMESPACE']
|
user_namespace: str = os.environ['CI_PROJECT_NAMESPACE']
|
||||||
project_name = os.environ['CI_PROJECT_NAME']
|
project_name: str = os.environ['CI_PROJECT_NAME']
|
||||||
branchname = os.environ['CI_COMMIT_REF_NAME']
|
branchname: str = os.environ['CI_COMMIT_REF_NAME']
|
||||||
|
|
||||||
useful_namespaces = ['gstreamer']
|
useful_namespaces: List[str] = ['gstreamer']
|
||||||
if branchname != 'master':
|
if branchname != 'master':
|
||||||
useful_namespaces.append(user_namespace)
|
useful_namespaces.append(user_namespace)
|
||||||
|
|
||||||
# Shouldn't be needed.
|
# Shouldn't be needed.
|
||||||
remote = "git://anongit.freedesktop.org/gstreamer/"
|
remote: str = "git://anongit.freedesktop.org/gstreamer/"
|
||||||
projects = ''
|
projects: str = ''
|
||||||
project_template = ' <project name="%s" remote="%s" revision="%s" />\n'
|
project_template: str = ' <project name="%s" remote="%s" revision="%s" />\n'
|
||||||
user_remote = os.path.dirname(os.environ['CI_PROJECT_URL'])
|
user_remote: str = os.path.dirname(os.environ['CI_PROJECT_URL'])
|
||||||
for module in GSTREAMER_MODULES:
|
for module in GSTREAMER_MODULES:
|
||||||
print("Checking %s:" % module, end=' ')
|
print("Checking %s:" % module, end=' ')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue