LSSTApplications  16.0-10-g0ee56ad+4,16.0-11-ga33d1f2+4,16.0-12-g3ef5c14+2,16.0-12-g71e5ef5+17,16.0-12-gbdf3636+2,16.0-13-g118c103+2,16.0-13-g8f68b0a+2,16.0-15-gbf5c1cb+3,16.0-16-gfd17674+2,16.0-17-g7c01f5c+2,16.0-18-g0a50484,16.0-20-ga20f992+7,16.0-21-g0e05fd4+5,16.0-21-g15e2d33+3,16.0-22-g62d8060+3,16.0-22-g847a80f+3,16.0-25-gf00d9b8,16.0-28-g3990c221+3,16.0-3-gf928089+2,16.0-32-g88a4f23+4,16.0-34-gd7987ad+2,16.0-37-gc7333cb+1,16.0-4-g10fc685+1,16.0-4-g18f3627+25,16.0-4-g5f3a788+25,16.0-5-gaf5c3d7+3,16.0-5-gcc1f4bb,16.0-6-g3b92700+3,16.0-6-g4412fcd+2,16.0-6-g7235603+3,16.0-69-g2562ce1b+1,16.0-7-g0913a87,16.0-8-g14ebd58+3,16.0-8-g2df868b,16.0-8-g4cec79c+5,16.0-8-gadf6c7a,16.0-82-g59ec2a54a,16.0-9-g5400cdc+1,16.0-9-ge6233d7+4,master-g2880f2d8cf+2,v17.0.rc1
LSSTDataManagementBasePackage
eupsForScons.py
Go to the documentation of this file.
1 import os
2 
3 try:
4  # Prefer to use native EUPS but if that is not available, fallback
5  # versions are defined. Only a subset of EUPS functions are required
6  # but all are imported to prevent warnings from redefinitions below.
7  from eups import * # noqa F403 F401
8  eupsLoaded = True
9 except ImportError:
10  eupsLoaded = False
11 
12 
13 def haveEups():
14  return eupsLoaded
15 
16 
17 if not haveEups():
18  #
19  # Fake what we can so sconsUtils can limp along without eups
20  #
21  def flavor():
22  from .state import env, log
23 
24  log.warn("Unable to import eups; guessing flavor")
25 
26  if env['PLATFORM'] == "posix":
27  return os.uname()[0].title()
28  else:
29  return env['PLATFORM'].title()
30 
31  def productDir(name):
32  return os.environ.get("%s_DIR" % name.upper())
33 
34  def findSetupVersion(eupsProduct):
35  return None, None, None, None, flavor()
36 
37  class _Eups:
38  def __call__(self):
39  return self
40  Eups = _Eups()
41 
42  Eups.findSetupVersion = findSetupVersion
43 
44  class _Utils:
45  pass
46  utils = _Utils()
47 
48  def setupEnvNameFor(productName):
49  return "SETUP_%s" % productName
50 
51  utils.setupEnvNameFor = setupEnvNameFor
52 
53 
54 def getEups():
55  """ Return a cached Eups instance, auto-creating if necessary """
56  try:
57  return getEups._eups
58  except AttributeError:
59  getEups._eups = Eups()
60  return getEups._eups