[vlc-devel] [PATCH 1/2] pkg-rewrite-absolute.py: use OrderedDict for variables

Alexandre Janniaux ajanni at videolabs.io
Wed Mar 11 14:20:00 CET 2020


Otherwise we can end up with .pc files having variables being used
before being declared, which is not supported by old pkg-config
executables. For example, on libplacebo.pc, with the (in)correct version
of python, it was ending up with:

libdir=${prefix}/lib
prefix=/foo

Refs videolan/vlc-android#1213
---
 contrib/src/pkg-rewrite-absolute.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/contrib/src/pkg-rewrite-absolute.py b/contrib/src/pkg-rewrite-absolute.py
index 8b7967c93c..4441f3f4eb 100755
--- a/contrib/src/pkg-rewrite-absolute.py
+++ b/contrib/src/pkg-rewrite-absolute.py
@@ -1,13 +1,14 @@
 #!/usr/bin/env python3
 import os, sys, argparse
+from collections import OrderedDict
 
 class PkgConfigFile():
     """Representation of a pkg-config file (.pc)"""
 
-    pc_variables = {}
-    pc_variables_expanded = {}
+    pc_variables = OrderedDict()
+    pc_variables_expanded = OrderedDict()
 
-    pc_keywords = {}
+    pc_keywords = OrderedDict()
 
     def __init__(self, file):
         for line in file:
-- 
2.25.1



More information about the vlc-devel mailing list