Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated CLI plugins #124

Merged
merged 5 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/omero/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1646,7 +1646,7 @@ def loadplugins(self):

def loadpath(self, pathobj):
if pathobj.isdir():
for plugin in pathobj.walkfiles("*.py"):
for plugin in sorted(pathobj.walkfiles("*.py")):
if -1 == plugin.find("#"): # Omit emacs files
self.loadpath(path(plugin))
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
GUI clients.
"""

DEPRECATION_MESSAGE = (
"This plugin is deprecated as of OMERO 5.4.8. Use the plugin"
" available from https://pypi.org/project/omero-metadata/"
" instead.")

ANNOTATION_TYPES = [t for t in dir(omero.model)
if re.match(r'[A-Za-z0-9]+Annotation$', t)]
Expand Down Expand Up @@ -285,6 +289,7 @@ def _format_ann(self, md, obj, indent=None):

def summary(self, args):
"Provide a general summary of available metadata"
self.ctx.err(DEPRECATION_MESSAGE, DeprecationWarning)
md = self._load(args)
name = md.get_name()
line = "-" * len(name)
Expand Down Expand Up @@ -332,6 +337,7 @@ def summary(self, args):

def original(self, args):
"Print the original metadata in ini format"
self.ctx.err(DEPRECATION_MESSAGE, DeprecationWarning)
md = self._load(args)
try:
source, global_om, series_om = md.get_original()
Expand Down Expand Up @@ -370,6 +376,7 @@ def _output_ann(self, mdobj, func, parents, indent):
def bulkanns(self, args):
("Provide a list of the NSBULKANNOTATION tables linked "
"to the given object")
self.ctx.err(DEPRECATION_MESSAGE, DeprecationWarning)
md = self._load(args)
indent = None
if args.report:
Expand All @@ -380,6 +387,7 @@ def bulkanns(self, args):
def measures(self, args):
("Provide a list of the NSMEASUREMENT tables linked "
"to the given object")
self.ctx.err(DEPRECATION_MESSAGE, DeprecationWarning)
md = self._load(args)
indent = None
if args.report:
Expand All @@ -394,7 +402,7 @@ def get_anns(md):
if args.nsre and not re.match(args.nsre, a.get_ns()):
continue
yield a

self.ctx.err(DEPRECATION_MESSAGE, DeprecationWarning)
md = self._load(args)
indent = None
if args.report:
Expand All @@ -408,7 +416,7 @@ def get_anns(md):
if args.nsre and not re.match(args.nsre, a.get_ns()):
continue
yield a

self.ctx.err(DEPRECATION_MESSAGE, DeprecationWarning)
md = self._load(args)
indent = None
if args.report:
Expand All @@ -417,6 +425,7 @@ def get_anns(md):

def testtables(self, args):
"Tests whether tables can be created and initialized"
self.ctx.err(DEPRECATION_MESSAGE, DeprecationWarning)
client, conn = self._clientconn(args)

sf = client.getSession()
Expand Down Expand Up @@ -449,6 +458,7 @@ def testtables(self, args):

def populate(self, args):
"Add metadata (bulk-annotations) to an object"
self.ctx.err(DEPRECATION_MESSAGE, DeprecationWarning)
md = self._load(args)
client, conn = self._clientconn(args)
# TODO: Configure logging properly
Expand Down Expand Up @@ -500,6 +510,7 @@ def populate(self, args):

def rois(self, args):
"Manage ROIs"
self.ctx.err(DEPRECATION_MESSAGE, DeprecationWarning)
md = self._load(args)
if args.delete:
graphspec = "/%s/Roi:%d" % (md.get_type(), md.get_id())
Expand Down Expand Up @@ -545,6 +556,7 @@ def rois(self, args):

def populateroi(self, args):
"Add ROIs to an object"
self.ctx.err(DEPRECATION_MESSAGE, DeprecationWarning)
md = self._load(args)
client = self.ctx.conn(args)
# TODO: Configure logging properly
Expand Down Expand Up @@ -574,6 +586,7 @@ def populateroi(self, args):

def pixelsize(self, args):
"Set physical pixel size"
self.ctx.err(DEPRECATION_MESSAGE, DeprecationWarning)
if not args.x and not args.y and not args.z:
self.ctx.die(100, "No pixel sizes specified.")

Expand Down Expand Up @@ -635,11 +648,7 @@ def pixelsize(self, args):

try:
if "OMERO_DEV_PLUGINS" in os.environ:
warnings.warn(
"This module is deprecated as of OMERO 5.4.8. Use the metadata"
" CLI plugin available from"
" https://pypi.org/project/omero-metadata/ instead.",
DeprecationWarning)
warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning)
register("metadata", MetadataControl, HELP)
except NameError:
if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _configure(self, parser):
def upload(self, args):
self.ctx.err(
"This module is deprecated as of OMERO 5.5.0. Use the module"
" available from https://pypi.org/project/omero-cli-upload/"
" available from https://pypi.org/project/omero-upload/"
" instead.", DeprecationWarning)
client = self.ctx.conn(args)
objIds = []
Expand All @@ -76,7 +76,7 @@ def upload(self, args):
warnings.warn(
"This plugin is deprecated as of OMERO 5.5.0. Use the upload"
" CLI plugin available from"
" https://pypi.org/project/omero-cli-upload/ instead.",
" https://pypi.org/project/omero-upload/ instead.",
DeprecationWarning)
register("upload", UploadControl, HELP)
except NameError:
Expand Down