diff --git a/build.py b/build.py index 21da3ecb..504aaca0 100755 --- a/build.py +++ b/build.py @@ -18,7 +18,8 @@ import tempfile import urllib2 from distutils.dep_util import newer, newer_group -from buildtools.config import Config, msg, opj, posixjoin, loadETG, etg2sip, findCmd +from buildtools.config import Config, msg, opj, posixjoin, loadETG, etg2sip, findCmd, \ + phoenixDir, wxDir from sphinxtools.postprocess import SphinxIndexes, MakeHeadings, PostProcess, GenGallery @@ -220,21 +221,6 @@ def setDevModeOptions(args): args[idx:idx+1] = myDevModeOptions -def phoenixDir(): - return os.path.abspath(os.path.split(__file__)[0]) - - -def wxDir(): - WXWIN = os.environ.get('WXWIN') - if not WXWIN: - for rel in ['../wxWidgets', '../wx', '..']: - path = os.path.join(phoenixDir(), rel) - if path and os.path.exists(path) and os.path.isdir(path): - WXWIN = os.path.abspath(os.path.join(phoenixDir(), rel)) - break - assert WXWIN not in [None, ''] - return WXWIN - def getMSWSettings(options): class MSWsettings(object): diff --git a/buildtools/config.py b/buildtools/config.py index a42a0d79..d737abc3 100644 --- a/buildtools/config.py +++ b/buildtools/config.py @@ -121,16 +121,7 @@ class Configuration(object): self.COMPILER=None self.WXPLAT2 = None - - - if os.environ.has_key('WXWIN'): - self.WXDIR = os.environ['WXWIN'] - else: - if os.path.exists('../wxWidgets'): - self.WXDIR = '../wxWidgets' # assumes in parallel SVN tree - else: - self.WXDIR = '..' # assumes wxPython is subdir - msg("WARNING: WXWIN not set in environment. Assuming '%s'" % self.WXDIR) + self.WXDIR = wxDir() self.includes = ['sip/siplib', # to get our version of sip.h 'src', # for any hand-written headers @@ -578,4 +569,20 @@ def findCmd(cmd): if os.path.exists(c): return c return None - \ No newline at end of file + + +def phoenixDir(): + return os.path.abspath(posixjoin(os.path.dirname(__file__), '..')) + + +def wxDir(): + WXWIN = os.environ.get('WXWIN') + if not WXWIN: + for rel in ['../wxWidgets', '../wx', '..']: + path = os.path.join(phoenixDir(), rel) + if path and os.path.exists(path) and os.path.isdir(path): + WXWIN = os.path.abspath(os.path.join(phoenixDir(), rel)) + break + assert WXWIN not in [None, ''] + return WXWIN +