setup: use absolute paths

This allows running the setup.py script from another directory. It is
required because pybuild runs tests into a temp dir which is a sub
folder of the sources.

Signed-off-by: Robin Jarry <robin@jarry.cc>

Gbp-Pq: Name setup-use-absolute-paths.patch
This commit is contained in:
Robin Jarry 2021-11-03 14:21:00 +01:00 committed by zhouganqing
parent 41b859202c
commit 1297d41738
1 changed files with 6 additions and 2 deletions

View File

@ -95,8 +95,12 @@ else:
)
def abspath(rel):
return os.path.join(os.path.dirname(__file__), rel)
def get_greenlet_version():
with open('src/greenlet/__init__.py') as f:
with open(abspath('src/greenlet/__init__.py')) as f:
looking_for = '__version__ = \''
for line in f:
if line.startswith(looking_for):
@ -109,7 +113,7 @@ setup(
name="greenlet",
version=get_greenlet_version(),
description='Lightweight in-process concurrent programming',
long_description=readfile("README.rst"),
long_description=readfile(abspath("README.rst")),
long_description_content_type="text/x-rst",
url="https://greenlet.readthedocs.io/",
keywords="greenlet coroutine concurrency threads cooperative",