Skip to content

Commit

Permalink
Change "diff" to "overrides"
Browse files Browse the repository at this point in the history
Following feedback from Nate Lust, the name "diff" may prove to be
confusing to some, as it implies a diff between two versions and not
necessarily a diff of all the product dependencies that come when
setting up that product. It was felt that a name change to "overrides"
(or, "-o" in short) would more accurately describe the operation here -
i.e., it shows what products the end-user has locally set up which
override those they would get when setting up lsst_distrib with a given
version/tag. To further accentuate that difference, dependent products
are now identified by virtue of a leading "|" symbol, as EUPS utilizes
for the "--dependencies" argument.
  • Loading branch information
leeskelvin committed Jul 10, 2024
1 parent fcee7bd commit 7d635cd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
29 changes: 18 additions & 11 deletions python/eups/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


def printProducts(productName=None, versionName=None, eupsenv=None,
tags=None, setup=False, tablefile=False, difference=False, directory=False,
tags=None, setup=False, tablefile=False, overrides=False, directory=False,
dependencies=False, showVersion=False, showName=False, showTagsGlob="*",
depth=None, productDir=None, topological=False, checkCycles=False, raw=False):
"""
Expand All @@ -32,8 +32,8 @@ def printProducts(productName=None, versionName=None, eupsenv=None,
@param setup restrict the listing to products that are currently
setup (or print actually setup versions with dependencies)
@param tablefile include the path to each product's table file
@param difference Print the relative complement (set difference) of declared version
products to setup products
@param overrides Print the local overrides of the declared product dependencies with
respect to currently setup products
@param directory include each product's installation directory
@param dependencies print the product's dependencies
@param showVersion Only print the product{'s,s'} version[s] (e.g. eups list -V -s afw)
Expand Down Expand Up @@ -65,8 +65,8 @@ def printProducts(productName=None, versionName=None, eupsenv=None,
if showTagsGlob == "*":
showTagsGlob = None

# Limit to "setup" products if we're only listing differences
if difference:
# Limit to "setup" products if we're only listing local overrides
if overrides:
setup = True

# If productDir is provided only list its dependencies; we do this by setting it up
Expand Down Expand Up @@ -103,11 +103,11 @@ def printProducts(productName=None, versionName=None, eupsenv=None,

raise ProductNotFound(productName, versionName, msg="Unable to find product %s" % msg)

if difference:
if overrides:
if versionName:
raise EupsException("--diff does not make sense with a version")
raise EupsException("--overrides does not make sense with a version")
if dependencies:
raise EupsException("--diff does not make sense with --dependencies")
raise EupsException("--overrides does not make sense with --dependencies")
setupProducts = set(eupsenv.getSetupProducts())
dependentProductList = eupsenv.getDependentProducts(productList[0])
dependentProducts = {x[0] for x in dependentProductList}
Expand All @@ -117,7 +117,7 @@ def printProducts(productName=None, versionName=None, eupsenv=None,

productList.sort(key=lambda p: (p.name, p.version))

if difference and productName:
if overrides and productName:
# Insert the main product name at the front of the list, to be printed first
productNameIndex = [i for i, p in enumerate(productList) if p.name == productName][0]
productList.insert(0, productList.pop(productList.index(productList[productNameIndex])))
Expand Down Expand Up @@ -216,7 +216,7 @@ def includeProduct(recursionDepth):
#
nprod = len(productList)
for pi in productList:
name, version, root = pi.name, pi.version, pi.stackRoot() # for convenience
name, version, root = pi.name, pi.version, pi.stackRoot() # for convenience
if root == "none": root = " (none)"
info = ""

Expand Down Expand Up @@ -272,8 +272,15 @@ def includeProduct(recursionDepth):
if info:
info += "|"
info += name + "|" + version
elif overrides:
if name != productName:
info += "|"
info += "%-21s " % (name)
if name == productName:
info += " "
info += "%-10s " % (version)
else:
if productName and not utils.isGlob(productName) and not difference:
if productName and not utils.isGlob(productName):
info += " "
else:
info += "%-21s " % (name)
Expand Down
7 changes: 4 additions & 3 deletions python/eups/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,6 @@ def addOptions(self):
# these are specific to this command
self.clo.add_option("-c", "--current", dest="currentTag", action="store_true", default=False,
help="same as --postTag=current")
self.clo.add_option("-C", "--diff", dest="difference", action="store_true", default=False,
help="Print the relative complement (set difference) of declared version products with respect to currently setup products")
self.clo.add_option("-D", "--dependencies", dest="depends", action="store_true", default=False,
help="Print product's dependencies (must specify version if ambiguous). With --setup print the versions of dependent products that are actually setup.")
self.clo.add_option("--depth", dest="depth", action="store",
Expand All @@ -467,6 +465,9 @@ def addOptions(self):
help="Follow the as-installed versions, not the dependencies in the table file ")
self.clo.add_option("--name", dest="showName", action="store_true", default=False,
help="Print the product's name")
self.clo.add_option("-o", "--overrides", dest="overrides", action="store_true", default=False,
help="Print the local overrides of the declared product dependencies with "
"respect to currently setup products")
self.clo.add_option("-r", "--root", dest="productDir", action="store",
help="root directory where product is installed")
self.clo.add_option("--raw", action="store_true",
Expand Down Expand Up @@ -510,7 +511,7 @@ def execute(self):
tags=self.opts.tag,
setup=self.opts.setup,
tablefile=self.opts.tablefile,
difference=self.opts.difference,
overrides=self.opts.overrides,
directory=self.opts.printdir,
dependencies=self.opts.depends,
showVersion=self.opts.version, showName=self.opts.showName,
Expand Down

0 comments on commit 7d635cd

Please sign in to comment.