Skip to content

Commit 08e1ae7

Browse files
committed
found way to determine vcc
1 parent 88f8ebb commit 08e1ae7

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

README.md

-9
Original file line numberDiff line numberDiff line change
@@ -488,15 +488,6 @@ files generated by Nim are platform specific, so they would only be of use to
488488
users on the same exact platform and architecture. This is why the official way
489489
of distributing Nimporter libraries is by creating binary wheels.
490490

491-
## Notes
492-
493-
Nimporter on Windows only works with the MSVC compiler via Nim's `--cc:vcc` flag
494-
because it is not possible to determine what C code Nim will generate based on
495-
several different layers of config files. In addition, if multiple compilers are
496-
installed on the target machine, this makes things even more difficult. To force
497-
Nimporter to use GCC on Windows, you can use `switches.py` on a per-project
498-
basis. However, pull requests are welcome if they can address this limitation.
499-
500491
## State Of The Project
501492

502493
I have implemented all of the features that I wanted to add at this time. I made

nimporter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class NimCompiler:
126126
'-d:strip',
127127
'-d:lto',
128128
'-d:ssl'
129-
] + (['--cc:vcc'] if sys.platform == 'win32' else [])
129+
] + (['--cc:vcc'] if 'MSC' in sys.version else [])
130130
EXT_DIR = 'nim-extensions'
131131

132132
@classmethod

tests/test_installation.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,12 @@ def test_create_bdist():
9393
f'{actual}'
9494
)
9595
finally:
96-
shutil.rmtree(str(dist.absolute()))
97-
shutil.rmtree(str(build.absolute()))
98-
shutil.rmtree(str(egg.absolute()))
96+
if dist.absolute().exists():
97+
shutil.rmtree(str(dist.absolute()))
98+
if build.absolute().exists():
99+
shutil.rmtree(str(build.absolute()))
100+
if egg.absolute().exists():
101+
shutil.rmtree(str(egg.absolute()))
99102

100103

101104
@pytest.mark.slow_integration_test
@@ -114,8 +117,10 @@ def test_install_sdist():
114117
assert target.exists()
115118
subprocess.Popen(f'{PIP} install {target}'.split()).wait()
116119
finally:
117-
shutil.rmtree(str(dist.absolute()))
118-
shutil.rmtree(str(egg.absolute()))
120+
if dist.absolute().exists():
121+
shutil.rmtree(str(dist.absolute()))
122+
if egg.absolute().exists():
123+
shutil.rmtree(str(egg.absolute()))
119124

120125
# Make sure that `tests/proj1` is not imported as a SimpleNamespace and that
121126
# the installed library in `site-packages` is used.

0 commit comments

Comments
 (0)