LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
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