146 """Get products and their versions from the environment. 151 Keys (type `str`) are product names; values (type `str`) are their 156 We use EUPS to determine the version of certain products (those that don't 157 provide a means to determine the version any other way) and to check if 158 uninstalled packages are being used. We only report the product/version 162 from eups
import Eups
163 from eups.Product
import Product
165 log.warning(
"Unable to import eups, so cannot determine package versions from environment")
172 products = _eups.findProducts(tags=[
"setup"])
176 packages = {prod.name: prod.version
for prod
in products
if prod
in ENVIRONMENT}
182 for prod
in products:
183 if not prod.version.startswith(Product.LocalVersionPrefix):
187 gitDir = os.path.join(prod.dir,
".git")
188 if os.path.exists(gitDir):
190 revCmd = [
"git",
"--git-dir=" + gitDir,
"--work-tree=" + prod.dir,
"rev-parse",
"HEAD"]
191 diffCmd = [
"git",
"--no-pager",
"--git-dir=" + gitDir,
"--work-tree=" + prod.dir,
"diff",
194 rev = subprocess.check_output(revCmd).decode().
strip()
195 diff = subprocess.check_output(diffCmd)
201 ver +=
"+" + hashlib.md5(diff).hexdigest()
205 packages[prod.name] = ver
def getEnvironmentPackages()