summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobert Managan <managan1@llnl.gov>2011-09-06 22:18:10 (GMT)
committerRobert Managan <managan1@llnl.gov>2011-09-06 22:18:10 (GMT)
commitf77a946d58be75dd9f76d6f7ea4597ec48d88edb (patch)
tree1dbb2eb05318f0c727ed5904880d4b3a54b1a431 /src
parent30d28b60f062a64a6b51266e14ba065bc9ef2f97 (diff)
downloadSCons-f77a946d58be75dd9f76d6f7ea4597ec48d88edb.zip
SCons-f77a946d58be75dd9f76d6f7ea4597ec48d88edb.tar.gz
SCons-f77a946d58be75dd9f76d6f7ea4597ec48d88edb.tar.bz2
Update path information for OSX.
If one of the tools that use TeX applications is generated add the paths in /etc/paths and /etc/paths.d version 10.5 (Leopard)
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt3
-rw-r--r--src/engine/SCons/Platform/darwin.py26
-rw-r--r--src/engine/SCons/Tool/dvipdf.py1
-rw-r--r--src/engine/SCons/Tool/dvips.py1
-rw-r--r--src/engine/SCons/Tool/latex.py1
-rw-r--r--src/engine/SCons/Tool/pdflatex.py1
-rw-r--r--src/engine/SCons/Tool/pdftex.py1
-rw-r--r--src/engine/SCons/Tool/tex.py33
8 files changed, 66 insertions, 1 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index b738ea8..79dfac1 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -185,6 +185,9 @@ RELEASE 2.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE
- Added support for the bibunits package so we call bibtex on all
the bu*.aux files.
+
+ - Add support of finding path information on OSX for TeX applications
+ MacPorts and Fink paths need to be added by the user
From Russel Winder:
diff --git a/src/engine/SCons/Platform/darwin.py b/src/engine/SCons/Platform/darwin.py
index 070719e..005673b 100644
--- a/src/engine/SCons/Platform/darwin.py
+++ b/src/engine/SCons/Platform/darwin.py
@@ -33,11 +33,35 @@ selection method.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import posix
+import os
def generate(env):
posix.generate(env)
env['SHLIBSUFFIX'] = '.dylib'
- env['ENV']['PATH'] = env['ENV']['PATH'] + ':/sw/bin'
+ # put macports paths at front to override Apple's versions, fink path is after
+ # For now let people who want Macports or Fink tools specify it!
+ # env['ENV']['PATH'] = '/opt/local/bin:/opt/local/sbin:' + env['ENV']['PATH'] + ':/sw/bin'
+
+ # Store extra system paths in env['ENV']['PATHOSX']
+
+ filelist = ['/etc/paths',]
+ # make sure this works on Macs with Tiger or earlier
+ try:
+ dirlist = os.listdir('/etc/paths.d')
+ except:
+ dirlist = []
+
+ for file in dirlist:
+ filelist.append('/etc/paths.d/'+file)
+
+ for file in filelist:
+ if os.path.isfile(file):
+ f = open(file, 'r')
+ lines = f.readlines()
+ for line in lines:
+ if line:
+ env.AppendENVPath('PATHOSX', line.strip('\n'))
+ f.close()
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Tool/dvipdf.py b/src/engine/SCons/Tool/dvipdf.py
index 56e90ea..7c41e9c 100644
--- a/src/engine/SCons/Tool/dvipdf.py
+++ b/src/engine/SCons/Tool/dvipdf.py
@@ -115,6 +115,7 @@ def generate(env):
env['PDFCOM'] = ['$DVIPDFCOM']
def exists(env):
+ SCons.Tool.tex.generate_darwin(env)
return env.Detect('dvipdf')
# Local Variables:
diff --git a/src/engine/SCons/Tool/dvips.py b/src/engine/SCons/Tool/dvips.py
index c682a21..198bda0 100644
--- a/src/engine/SCons/Tool/dvips.py
+++ b/src/engine/SCons/Tool/dvips.py
@@ -85,6 +85,7 @@ def generate(env):
env['PSSUFFIX'] = '.ps'
def exists(env):
+ SCons.Tool.tex.generate_darwin(env)
return env.Detect('dvips')
# Local Variables:
diff --git a/src/engine/SCons/Tool/latex.py b/src/engine/SCons/Tool/latex.py
index 283a8b4..1c71743 100644
--- a/src/engine/SCons/Tool/latex.py
+++ b/src/engine/SCons/Tool/latex.py
@@ -70,6 +70,7 @@ def generate(env):
SCons.Tool.tex.generate_common(env)
def exists(env):
+ SCons.Tool.tex.generate_darwin(env)
return env.Detect('latex')
# Local Variables:
diff --git a/src/engine/SCons/Tool/pdflatex.py b/src/engine/SCons/Tool/pdflatex.py
index 78204d9..922e718 100644
--- a/src/engine/SCons/Tool/pdflatex.py
+++ b/src/engine/SCons/Tool/pdflatex.py
@@ -74,6 +74,7 @@ def generate(env):
SCons.Tool.tex.generate_common(env)
def exists(env):
+ SCons.Tool.tex.generate_darwin(env)
return env.Detect('pdflatex')
# Local Variables:
diff --git a/src/engine/SCons/Tool/pdftex.py b/src/engine/SCons/Tool/pdftex.py
index 33a41f2..30c56af 100644
--- a/src/engine/SCons/Tool/pdftex.py
+++ b/src/engine/SCons/Tool/pdftex.py
@@ -99,6 +99,7 @@ def generate(env):
SCons.Tool.tex.generate_common(env)
def exists(env):
+ SCons.Tool.tex.generate_darwin(env)
return env.Detect('pdftex')
# Local Variables:
diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py
index 77e6e79..b0c518e 100644
--- a/src/engine/SCons/Tool/tex.py
+++ b/src/engine/SCons/Tool/tex.py
@@ -739,9 +739,28 @@ def generate(env):
bld.add_action('.tex', TeXLaTeXAction)
bld.add_emitter('.tex', tex_eps_emitter)
+def generate_darwin(env):
+ try:
+ environ = env['ENV']
+ except KeyError:
+ environ = {}
+ env['ENV'] = environ
+
+ if (platform.system() == 'Darwin'):
+ try:
+ ospath = env['ENV']['PATHOSX']
+ except:
+ ospath = None
+ if ospath:
+ env.AppendENVPath('PATH', ospath)
+
def generate_common(env):
"""Add internal Builders and construction variables for LaTeX to an Environment."""
+ # Add OSX system paths so TeX tools can be found
+ # when a list of tools is given the exists() method is not called
+ generate_darwin(env)
+
# A generic tex file Action, sufficient for all tex files.
global TeXAction
if TeXAction is None:
@@ -778,6 +797,19 @@ def generate_common(env):
if MakeAcronymsAction is None:
MakeAcronymsAction = SCons.Action.Action("$MAKEACRONYMSCOM", "$MAKEACRONYMSCOMSTR")
+ try:
+ environ = env['ENV']
+ except KeyError:
+ environ = {}
+ env['ENV'] = environ
+
+ # Some Linux platforms have pdflatex set up in a way
+ # that requires that the HOME environment variable be set.
+ # Add it here if defined.
+ v = os.environ.get('HOME')
+ if v:
+ environ['HOME'] = v
+
CDCOM = 'cd '
if platform.system() == 'Windows':
# allow cd command to change drives on Windows
@@ -824,6 +856,7 @@ def generate_common(env):
env['MAKENCLCOM'] = CDCOM + '${TARGET.dir} && $MAKENCL ${SOURCE.filebase}.nlo $MAKENCLFLAGS -o ${SOURCE.filebase}.nls'
def exists(env):
+ generate_darwin(env)
return env.Detect('tex')
# Local Variables: