LSSTApplications  11.0-13-gbb96280,12.1.rc1,12.1.rc1+1,12.1.rc1+2,12.1.rc1+5,12.1.rc1+8,12.1.rc1-1-g06d7636+1,12.1.rc1-1-g253890b+5,12.1.rc1-1-g3d31b68+7,12.1.rc1-1-g3db6b75+1,12.1.rc1-1-g5c1385a+3,12.1.rc1-1-g83b2247,12.1.rc1-1-g90cb4cf+6,12.1.rc1-1-g91da24b+3,12.1.rc1-2-g3521f8a,12.1.rc1-2-g39433dd+4,12.1.rc1-2-g486411b+2,12.1.rc1-2-g4c2be76,12.1.rc1-2-gc9c0491,12.1.rc1-2-gda2cd4f+6,12.1.rc1-3-g3391c73+2,12.1.rc1-3-g8c1bd6c+1,12.1.rc1-3-gcf4b6cb+2,12.1.rc1-4-g057223e+1,12.1.rc1-4-g19ed13b+2,12.1.rc1-4-g30492a7
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 
11 def haveEups():
12  return eupsLoaded
13 
14 if not haveEups():
15  #
16  # Fake what we can so sconsUtils can limp along without eups
17  #
18  def flavor():
19  from .state import env, log
20 
21  log.warn("Unable to import eups; guessing flavor")
22 
23  if env['PLATFORM'] == "posix":
24  return os.uname()[0].title()
25  else:
26  return env['PLATFORM'].title()
27 
28  def productDir(name):
29  return os.environ.get("%s_DIR" % name.upper())
30 
31  def findSetupVersion(eupsProduct):
32  return None, None, None, None, flavor()
33 
34  class _Eups(object):
35  def __call__(self):
36  return self
37  Eups = _Eups()
38 
39  Eups.findSetupVersion = findSetupVersion
40 
41  class _Utils(object):
42  pass
43  utils = _Utils()
44 
45  def setupEnvNameFor(productName):
46  return "SETUP_%s" % productName
47 
48  utils.setupEnvNameFor = setupEnvNameFor
49 
50 
51 def getEups():
52  """ Return a cached Eups instance, auto-creating if necessary """
53  try:
54  return getEups._eups
55  except AttributeError:
56  getEups._eups = Eups()
57  return getEups._eups