aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2022-07-29 08:35:47 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2022-07-29 08:35:47 +0300
commitceb987b9c34a30d03f258976839846a472423554 (patch)
tree9266d3c76dcabc9b5b05f6e7793904eaad08941c /src/snakeoil/dist
parentRevert "distutils_extensions: fix import w/ newer setuptools(?)" (diff)
downloadsnakeoil-ceb987b9c34a30d03f258976839846a472423554.tar.gz
snakeoil-ceb987b9c34a30d03f258976839846a472423554.tar.bz2
snakeoil-ceb987b9c34a30d03f258976839846a472423554.zip
distutils_extensions: fix import w/ newer setuptools
Diffstat (limited to 'src/snakeoil/dist')
-rw-r--r--src/snakeoil/dist/distutils_extensions.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/snakeoil/dist/distutils_extensions.py b/src/snakeoil/dist/distutils_extensions.py
index 0e5303a9..9f9d8e57 100644
--- a/src/snakeoil/dist/distutils_extensions.py
+++ b/src/snakeoil/dist/distutils_extensions.py
@@ -51,7 +51,9 @@ if REPODIR is None:
REPODIR = os.path.dirname(os.path.abspath(_filename))
break
else:
- raise ImportError('this module is only meant to be imported in setup.py scripts')
+ REPODIR = os.getcwd() # try CWD
+ if not os.path.exists(os.path.join(REPODIR, 'setup.py')):
+ raise ImportError('this module is only meant to be imported in setup.py scripts')
# running under pip
PIP = os.path.basename(os.environ.get('_', '')) == 'pip' or REPODIR.split(os.sep)[2].startswith('pip-')