Skip to content

Commit 3e333d5

Browse files
setup.py: clearer errors when searching for VS.
Also use new pipcl.show_system().
1 parent 153ef19 commit 3e333d5

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

setup.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@
194194
import subprocess
195195
import sys
196196
import tarfile
197+
import traceback
197198
import urllib.request
198199
import zipfile
199200

@@ -221,21 +222,7 @@ def run(command, check=1):
221222
if 1:
222223
# For debugging.
223224
log(f'### Starting.')
224-
log(f'__name__: {__name__!r}')
225-
log(f'platform.platform(): {platform.platform()!r}')
226-
log(f'platform.python_version(): {platform.python_version()!r}')
227-
log(f'sys.executable: {sys.executable!r}')
228-
log(f'CPU bits: {32 if sys.maxsize == 2**31 - 1 else 64} {sys.maxsize=}')
229-
log(f'__file__: {__file__!r}')
230-
log(f'os.getcwd(): {os.getcwd()!r}')
231-
log(f'getconf ARG_MAX: {pipcl.run("getconf ARG_MAX", capture=1, check=0, verbose=0)!r}')
232-
log(f'sys.argv ({len(sys.argv)}):')
233-
for i, arg in enumerate(sys.argv):
234-
log(f' {i}: {arg!r}')
235-
log(f'os.environ ({len(os.environ)}):')
236-
for k in sorted( os.environ.keys()):
237-
v = os.environ[ k]
238-
log( f' {k}: {v!r}')
225+
pipcl.show_system()
239226

240227

241228
PYMUPDF_SETUP_FLAVOUR = os.environ.get( 'PYMUPDF_SETUP_FLAVOUR', 'pbd')
@@ -802,7 +789,18 @@ def build_mupdf_windows(
802789
#log( f'Building mupdf.')
803790
devenv = os.environ.get('PYMUPDF_SETUP_DEVENV')
804791
if not devenv:
805-
vs = pipcl.wdev.WindowsVS()
792+
try:
793+
# Prefer VS-2019 as that is what MuPDF's project/solution files are
794+
# written for.
795+
log(f'Looking for Visual Studio 2019.')
796+
vs = pipcl.wdev.WindowsVS(year=2019)
797+
except Exception as e:
798+
log(f'Failed to find VS-2019:\n'
799+
f'{textwrap.indent(traceback.format_exc(), " ")}'
800+
)
801+
log(f'Looking for any Visual Studio.')
802+
vs = pipcl.wdev.WindowsVS()
803+
log(f'vs:\n{vs.description_ml(" ")}')
806804
devenv = vs.devenv
807805
if not devenv:
808806
devenv = 'devenv.com'

0 commit comments

Comments
 (0)