File: setup-use-absolute-paths.patch

package info (click to toggle)
python-greenlet 3.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,032 kB
  • sloc: cpp: 5,045; python: 3,160; ansic: 1,125; makefile: 155; asm: 120; sh: 42
file content (51 lines) | stat: -rw-r--r-- 1,843 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From: Robin Jarry <robin@jarry.cc>
Date: Wed, 3 Nov 2021 14:21:00 +0100
Subject: 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>
---
 setup.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/setup.py b/setup.py
index df80287..92f5111 100755
--- a/setup.py
+++ b/setup.py
@@ -113,10 +113,13 @@ def readfile(filename):
     with open(filename, 'r') as f: # pylint:disable=unspecified-encoding
         return f.read()
 
-GREENLET_SRC_DIR = 'src/greenlet/'
+def abspath(rel):
+    return os.path.join(os.path.dirname(__file__), rel)
+
+GREENLET_SRC_DIR = abspath('src/greenlet/')
 GREENLET_HEADER_DIR = GREENLET_SRC_DIR
 GREENLET_HEADER = GREENLET_HEADER_DIR + 'greenlet.h'
-GREENLET_TEST_DIR = 'src/greenlet/tests/'
+GREENLET_TEST_DIR = abspath('src/greenlet/tests/')
 # The location of the platform specific assembly files
 # for switching.
 GREENLET_PLATFORM_DIR = GREENLET_SRC_DIR + 'platform/'
@@ -193,7 +196,7 @@ else:
 
 
 def get_greenlet_version():
-    with open('src/greenlet/__init__.py') as f: # pylint:disable=unspecified-encoding
+    with open(abspath('src/greenlet/__init__.py')) as f:
         looking_for = '__version__ = \''
         for line in f:
             if line.startswith(looking_for):
@@ -206,7 +209,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",