File tree Expand file tree Collapse file tree 3 files changed +39
-3
lines changed Expand file tree Collapse file tree 3 files changed +39
-3
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python
2
2
3
+ import os
3
4
import sys
4
- import versioneer
5
5
6
6
from distutils .text_file import TextFile
7
7
from skbuild import setup
8
8
9
+ # Add current folder to path
10
+ # This is required to import versioneer in an isolated pip build
11
+ sys .path .append (os .path .dirname (os .path .abspath (__file__ )))
12
+
13
+ import versioneer # noqa: E402
14
+
9
15
10
16
with open ('README.rst' , 'r' ) as fp :
11
17
readme = fp .read ()
Original file line number Diff line number Diff line change 3
3
import pytest
4
4
import textwrap
5
5
6
- from path import Path
6
+ from path import Path , matchers
7
7
8
8
DIST_DIR = os .path .abspath (os .path .join (os .path .dirname (__file__ ), '../dist' ))
9
9
@@ -26,6 +26,21 @@ def _check_cmake_install(virtualenv, tmpdir):
26
26
assert output [:len (expected )].lower () == expected .lower ()
27
27
28
28
29
+ @pytest .mark .skipif (not Path (DIST_DIR ).exists (), reason = "dist directory does not exist" )
30
+ def test_source_distribution (virtualenv , tmpdir ):
31
+ sdists = Path (DIST_DIR ).files (match = matchers .CaseInsensitive ("*.tar.gz" ))
32
+ if not sdists :
33
+ pytest .skip ("no source distribution available" )
34
+ assert len (sdists ) == 1
35
+
36
+ if "SETUP_CMAKE_ARGS" in os .environ :
37
+ virtualenv .env ["SKBUILD_CONFIGURE_OPTIONS" ] = os .environ ["SETUP_CMAKE_ARGS" ]
38
+ virtualenv .run ("pip install %s" % sdists [0 ])
39
+ assert "cmake" in virtualenv .installed_packages ()
40
+
41
+ _check_cmake_install (virtualenv , tmpdir )
42
+
43
+
29
44
@pytest .mark .skipif (not Path (DIST_DIR ).exists (), reason = "dist directory does not exist" )
30
45
def test_wheel (virtualenv , tmpdir ):
31
46
wheels = Path (DIST_DIR ).files (match = "*.whl" )
Original file line number Diff line number Diff line change @@ -1283,7 +1283,22 @@ def render_pep440_post(pieces):
1283
1283
if pieces ["closest-tag" ]:
1284
1284
rendered = pieces ["closest-tag" ]
1285
1285
if pieces ["distance" ] or pieces ["dirty" ]:
1286
- rendered += ".post%d" % pieces ["distance" ]
1286
+ if ".post" in rendered :
1287
+ # update the existing post tag
1288
+ start = rendered .index (".post" ) + 5
1289
+ if len (rendered ) == start :
1290
+ rendered += "%d" % pieces ["distance" ]
1291
+ else :
1292
+ end = start + 1
1293
+ while end <= len (rendered ) and rendered [start :end ].isdigit ():
1294
+ end += 1
1295
+ end -= 1
1296
+ distance = pieces ["distance" ]
1297
+ if start != end :
1298
+ distance += int (rendered [start :end ])
1299
+ rendered = rendered [:start ] + "%d" % distance + rendered [end :]
1300
+ else :
1301
+ rendered += ".post%d" % pieces ["distance" ]
1287
1302
if pieces ["dirty" ]:
1288
1303
rendered += ".dev0"
1289
1304
rendered += plus_or_dot (pieces )
You can’t perform that action at this time.
0 commit comments