Skip to content

Commit 051f409

Browse files
committed
pylibfdt: Allow version normalization to fail
In some cases, we might not have the sic portion of setuputils available. Make our import and use of this be done in try/except blocks as this is done to suppress a run-time warning that is otherwise non-fatal. Reported-by: Pali Rohár <[email protected]> Fixes: 1416591 ("pylibfdt: Fix disable version normalization") Signed-off-by: Tom Rini <[email protected]>
1 parent d1f4b09 commit 051f409

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

scripts/dtc/pylibfdt/setup.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,17 @@
2020
./pylibfdt/setup.py install [--prefix=...]
2121
"""
2222

23-
from setuptools import setup, Extension, sic
23+
from setuptools import setup, Extension
2424
from setuptools.command.build_py import build_py as _build_py
2525
import os
2626
import re
2727
import sys
2828

29+
try:
30+
from setuptools import sic
31+
except ImportError:
32+
pass
33+
2934
srcdir = os.path.dirname(__file__)
3035

3136
with open(os.path.join(srcdir, "../README"), "r") as fh:
@@ -113,7 +118,10 @@ def GetEnvFromMakefiles():
113118
files = os.environ.get('SOURCES', '').split()
114119
cflags = os.environ.get('CPPFLAGS', '').split()
115120
objdir = os.environ.get('OBJDIR')
116-
version = os.environ.get('VERSION')
121+
try:
122+
version = sic(os.environ.get('VERSION'))
123+
except:
124+
version = os.environ.get('VERSION')
117125
swig_opts = os.environ.get('SWIG_OPTS', '').split()
118126

119127
# If we were called directly rather than through our Makefile (which is often
@@ -137,7 +145,7 @@ def run(self):
137145

138146
setup(
139147
name='libfdt',
140-
version=sic(version),
148+
version=version,
141149
cmdclass = {'build_py' : build_py},
142150
author='Simon Glass',
143151
author_email='[email protected]',

0 commit comments

Comments
 (0)