You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.0 KiB
32 lines
1.0 KiB
From 253d1f6021765051c26d4427967786040d215853 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Date: Mon, 6 May 2019 22:36:43 +0200
|
|
Subject: [PATCH 05/14] Check /usr/lib/os-release in addition to
|
|
/etc/os-release
|
|
|
|
---
|
|
rust2rpm/__main__.py | 7 +++++--
|
|
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py
|
|
index b307505..b8d3772 100644
|
|
--- a/rust2rpm/__main__.py
|
|
+++ b/rust2rpm/__main__.py
|
|
@@ -34,8 +34,11 @@ JINJA_ENV = jinja2.Environment(
|
|
lstrip_blocks=True)
|
|
|
|
def get_default_target():
|
|
- # TODO: add fallback for /usr/lib/os-release
|
|
- with open("/etc/os-release") as os_release_file:
|
|
+ try:
|
|
+ os_release_file = open('/etc/os-release')
|
|
+ except FileNotFoundError:
|
|
+ os_release_file = open('/usr/lib/os-release')
|
|
+ with os_release_file:
|
|
conf = configparser.ConfigParser()
|
|
conf.read_file(itertools.chain(["[os-release]"], os_release_file))
|
|
os_release = conf["os-release"]
|
|
--
|
|
2.22.0.rc3
|
|
|