Skip to content

Commit

Permalink
merge master -Dorg -Ssuccess-only: PR 193 (cli: don't unset ICE_CONFIG (
Browse files Browse the repository at this point in the history
fix ome#191))
  • Loading branch information
snoopycrimecop committed Mar 8, 2020
2 parents 8a8c7d6 + 8e9395a commit 4b620b6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 43 deletions.
78 changes: 35 additions & 43 deletions src/omero/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1717,49 +1717,41 @@ def argv(args=sys.argv):
Finally, the cli enters a command loop reading from standard in.
"""

# Modiying the run-time environment
old_ice_config = os.getenv("ICE_CONFIG")
os.unsetenv("ICE_CONFIG")
try:

# Modifying the args list if the name of the file
# has arguments encoded in it
original_executable = path(args[0])
base_executable = str(original_executable.basename())
if base_executable.find("-") >= 0:
parts = base_executable.split("-")
for arg in args[1:]:
parts.append(arg)
args = parts

# Now load other plugins. After debugging is turned on, but before
# tracing.
cli = CLI(prog=original_executable.split("-")[0])

parser = Parser(add_help=False)
# parser.add_argument("-d", "--debug", help="Use 'help debug' for more
# information", default = SUPPRESS)
parser.add_argument(
"--path", action="append",
help="Add file or directory to plugin list. Supports globs.")
ns, args = parser.parse_known_args(args)
if getattr(ns, "path"):
for p in ns.path:
for g in glob.glob(p):
cli._plugin_paths.append(g)

# For argparse dispatch, this cannot be done lazily
cli.loadplugins()

if len(args) > 1:
cli.invoke(args[1:])
return cli.rv
else:
cli.invokeloop()
return cli.rv
finally:
if old_ice_config:
os.putenv("ICE_CONFIG", old_ice_config)
# Modifying the args list if the name of the file
# has arguments encoded in it
original_executable = path(args[0])
base_executable = str(original_executable.basename())
if base_executable.find("-") >= 0:
parts = base_executable.split("-")
for arg in args[1:]:
parts.append(arg)
args = parts

# Now load other plugins. After debugging is turned on, but before
# tracing.
cli = CLI(prog=original_executable.split("-")[0])

parser = Parser(add_help=False)
# parser.add_argument("-d", "--debug", help="Use 'help debug' for more
# information", default = SUPPRESS)
parser.add_argument(
"--path", action="append",
help="Add file or directory to plugin list. Supports globs.")
ns, args = parser.parse_known_args(args)
if getattr(ns, "path"):
for p in ns.path:
for g in glob.glob(p):
cli._plugin_paths.append(g)

# For argparse dispatch, this cannot be done lazily
cli.loadplugins()

if len(args) > 1:
cli.invoke(args[1:])
return cli.rv
else:
cli.invokeloop()
return cli.rv

#####################################################
#
Expand Down
1 change: 1 addition & 0 deletions src/omero/plugins/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,7 @@ def _check(msg, vers):
# See ticket #10051
popen = self.ctx.popen(["icegridnode", "--version"])
env = self.ctx._env()
# Unclear how this could have been set with the call to unsetenv
ice_config = env.get("ICE_CONFIG")
if ice_config is not None and not os.path.exists(ice_config):
popen = self.ctx.popen(["icegridnode", "--version"],
Expand Down

0 comments on commit 4b620b6

Please sign in to comment.