SHA256
1
0
forked from pool/brickv
brickv/0001-Support-to-use-local-iso-codes-and-mobile-providers-.patch
Dmitry Roshchin dd68355ca2 Accepting request 734896 from home:frank_kunz
I want to maintain brickv in Factory and would like to use electronics as the devel/feeder project.

OBS-URL: https://build.opensuse.org/request/show/734896
OBS-URL: https://build.opensuse.org/package/show/electronics/brickv?expand=0&rev=1
2019-10-06 11:53:57 +00:00

45 lines
1.9 KiB
Diff

From 9d865bd9027f0fea4835886495ce235b6591a016 Mon Sep 17 00:00:00 2001
From: Frank Kunz <mailinglists@kunz-im-inter.net>
Date: Mon, 30 Sep 2019 12:02:07 +0200
Subject: [PATCH 1/2] Support to use local iso codes and mobile providers
database
This allows to select an already installed iso codes and mobile
providers database during build instead of downloading them. It
simplifies package build when the build environment does not have
an internet connection. To select local installed files the two
environment variables SERVICEPROVIDERS_XML_PATH and ISOCODES_JSON_PATH
can be set. E.g.:
SERVICEPROVIDERS_XML_PATH=/path/to/serviceproviders.xml ISOCODES_JSON_PATH=/path/to/iso_3166-1.json ./build_src.py
Signed-off-by: Frank Kunz <mailinglists@kunz-im-inter.net>
---
.../plugins/red/build_serviceproviders.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/brickv/plugin_system/plugins/red/build_serviceproviders.py b/src/brickv/plugin_system/plugins/red/build_serviceproviders.py
index 018923dc..96397755 100644
--- a/src/brickv/plugin_system/plugins/red/build_serviceproviders.py
+++ b/src/brickv/plugin_system/plugins/red/build_serviceproviders.py
@@ -31,8 +31,14 @@ import urllib.error
import xml.etree.ElementTree as ET
from pprint import pformat
-XML_URL = 'https://git.gnome.org/browse/mobile-broadband-provider-info/plain/serviceproviders.xml'
-ISO3166_URL = 'https://salsa.debian.org/iso-codes-team/iso-codes/raw/master/data/iso_3166-1.json'
+try:
+ XML_URL = 'file://{0}'.format(os.environ['SERVICEPROVIDERS_XML_PATH'])
+except KeyError:
+ XML_URL = 'https://git.gnome.org/browse/mobile-broadband-provider-info/plain/serviceproviders.xml'
+try:
+ ISO3166_URL = 'file://{0}'.format(os.environ['ISOCODES_JSON_PATH'])
+except KeyError:
+ ISO3166_URL = 'https://salsa.debian.org/iso-codes-team/iso-codes/raw/master/data/iso_3166-1.json'
DATA_FILE = 'serviceprovider_data.py'
try:
--
2.23.0