convert App to subclass of dict to support parsing/dumping libs

Python is heavily based on its core data types, and dict is one of the more
important ones.  Even classes are basically a wrapper around a dict. This
converts metadata.App to be a subclass of dict so it can behave like a dict
when being dumped and loaded.  This makes its drastically easier to use
different data formats for build metadata and for sending data to the
client.  This approach will ultimately mean we no longer have to maintain
custom parsing and dumping code.

This also means then that the YAML/JSON field names will not have spaces in
them, and they will match exactly what it used as the dict keys once the
data is parsed, as well as matching exactly the instance attribute names:

* CurrentVersion: 1.2.6
* app['CurrentVersion'] == '1.2.6'
* app.CurrentVersion == '1.2.6'

Inspired by:
https://goodcode.io/articles/python-dict-object/
This commit is contained in:
Hans-Christoph Steiner 2016-11-23 17:25:59 +01:00
parent 4625651192
commit b7fc7f2228
10 changed files with 165 additions and 229 deletions

View file

@ -1,12 +1,12 @@
Categories:
- Multimedia
License: GPLv3
Web Site: http://www.videolan.org/vlc/download-android.html
Source Code: http://git.videolan.org/?p=vlc-ports/android.git;a=summary
Issue Tracker: "http://www.videolan.org/support/index.html#bugs"
WebSite: http://www.videolan.org/vlc/download-android.html
SourceCode: http://git.videolan.org/?p=vlc-ports/android.git;a=summary
IssueTracker: "http://www.videolan.org/support/index.html#bugs"
Donate: "http://www.videolan.org/contribute.html#money"
Auto Name: VLC
AutoName: VLC
Summary: Media player
Description: |
Video and audio player that supports a wide range of formats,
@ -14,7 +14,7 @@ Description: |
[http://git.videolan.org/?p=vlc-ports/android.git;a=blob_plain;f=NEWS NEWS]
Repo Type: git
RepoType: git
Repo: git://git.videolan.org/vlc-ports/android.git
builds:
@ -875,7 +875,7 @@ builds:
buildjni: no
ndk: r10d
Maintainer Notes: |
MaintainerNotes: |
Instructions and dependencies here: http://wiki.videolan.org/AndroidCompile
see http://buildbot.videolan.org/builders/ for version code scheme
The VLC srclib commit can be found out from TESTED_HASH value in compile.sh
@ -902,10 +902,10 @@ Maintainer Notes: |
# +2: x86
# +3: arm
# +4: armv7 (CV)
Archive Policy: 9 versions
Auto Update Mode: None
Update Check Mode: Tags
ArchivePolicy: 9 versions
AutoUpdateMode: None
UpdateCheckMode: Tags
# Only use higher vercode ops, if we do build those arches
Vercode Operation: "%c + 5"
Current Version: 1.2.6
Current Version Code: 1030005
VercodeOperation: "%c + 5"
CurrentVersion: 1.2.6
CurrentVersionCode: 1030005