LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
eupsForScons.py
Go to the documentation of this file.
1 from __future__ import absolute_import, division, print_function
2 import os
3 
4 try:
5  from eups import *
6  eupsLoaded = True
7 except ImportError:
8  eupsLoaded = False
9 
10 def haveEups():
11  return eupsLoaded
12 
13 if not haveEups():
14  #
15  # Fake what we can so sconsUtils can limp along without eups
16  #
17  def flavor():
18  from .state import env, log
19 
20  log.warn("Unable to import eups; guessing flavor")
21 
22  if env['PLATFORM'] == "posix":
23  return os.uname()[0].title()
24  else:
25  return env['PLATFORM'].title()
26 
27  def productDir(name):
28  return os.environ.get("%s_DIR" % name.upper())
29 
30  def findSetupVersion(eupsProduct):
31  return None, None, None, None, flavor()
32 
33  class _Eups(object):
34  def __call__(self):
35  return self
36  Eups = _Eups()
37 
38  Eups.findSetupVersion = findSetupVersion
39 
40  class _Utils(object):
41  pass
42  utils = _Utils()
43 
44  def setupEnvNameFor(productName):
45  return "SETUP_%s" % productName
46 
47  utils.setupEnvNameFor = setupEnvNameFor
48 
49 def getEups():
50  """ Return a cached Eups instance, auto-creating if necessary """
51  try:
52  return getEups._eups
53  except AttributeError:
54  getEups._eups = Eups()
55  return getEups._eups