mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Cleanup path handling when building on windows
This commit is contained in:
parent
26c0108beb
commit
0f2aff9a4a
@ -405,7 +405,7 @@ class Build(Command):
|
||||
|
||||
If something is missing (qmake e.g.) you get a non-informative error
|
||||
self.check_call(qmc + [ext.name+'.pro'])
|
||||
so you would have to look a the source to see the actual command.
|
||||
so you would have to look at the source to see the actual command.
|
||||
"""
|
||||
try:
|
||||
subprocess.check_call(*args, **kwargs)
|
||||
|
@ -7,25 +7,37 @@ __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os, subprocess, re, shutil
|
||||
from distutils.spawn import find_executable
|
||||
|
||||
from setup import ismacos, iswindows, is64bit, islinux, ishaiku
|
||||
|
||||
NMAKE = RC = msvc = MT = win_inc = win_lib = win_cc = win_ld = None
|
||||
|
||||
|
||||
def merge_paths(a, b):
|
||||
a = [os.path.normcase(os.path.normpath(x)) for x in a.split(os.pathsep)]
|
||||
for q in b.split(os.pathsep):
|
||||
q = os.path.normcase(os.path.normpath(q))
|
||||
if q not in a:
|
||||
a.append(q)
|
||||
return os.pathsep.join(a)
|
||||
|
||||
|
||||
if iswindows:
|
||||
from setup.vcvars import query_vcvarsall
|
||||
env = query_vcvarsall(is64bit)
|
||||
NMAKE = shutil.which('nmake.exe', path=env['PATH'])
|
||||
RC = shutil.which('rc.exe', path=env['PATH'])
|
||||
MT = shutil.which('mt.exe', path=env['PATH'])
|
||||
win_cc = shutil.which('cl.exe', path=env['PATH'])
|
||||
win_ld = shutil.which('link.exe', path=env['PATH'])
|
||||
win_path = env['PATH']
|
||||
os.environ['PATH'] = merge_paths(env['PATH'], os.environ['PATH'])
|
||||
NMAKE = 'nmake.exe'
|
||||
RC = 'rc.exe'
|
||||
MT = 'mt.exe'
|
||||
win_cc = 'cl.exe'
|
||||
win_ld = 'link.exe'
|
||||
win_inc = [x for x in env['INCLUDE'].split(';') if x]
|
||||
win_lib = [x for x in env['LIB'].split(';') if x]
|
||||
|
||||
QMAKE = 'qmake'
|
||||
for x in ('qmake-qt5', 'qt5-qmake', 'qmake'):
|
||||
q = find_executable(x)
|
||||
q = shutil.which(x)
|
||||
if q:
|
||||
QMAKE = q
|
||||
break
|
||||
@ -33,7 +45,7 @@ QMAKE = os.environ.get('QMAKE', QMAKE)
|
||||
if iswindows and not QMAKE.lower().endswith('.exe'):
|
||||
QMAKE += '.exe'
|
||||
|
||||
PKGCONFIG = find_executable('pkg-config')
|
||||
PKGCONFIG = shutil.which('pkg-config')
|
||||
PKGCONFIG = os.environ.get('PKG_CONFIG', PKGCONFIG)
|
||||
if (islinux or ishaiku) and not PKGCONFIG:
|
||||
raise SystemExit('Failed to find pkg-config on your system. You can use the environment variable PKG_CONFIG to point to the pkg-config executable')
|
||||
|
Loading…
x
Reference in New Issue
Block a user