Skip to contentSkip to conversation

nvmetcli fixes

PATCH New Andy Grover 2 participants 8 messages Oct 13, 2016 – Oct 14, 2016 NVMe

lore
Share & tools
lore
#0 lore raw

cover nvmetcli fixes

Here are some small fixes that help packaging nvmetcli, and help it minimally work with Python 3 -- there are likely more Py2/3 issues that will come out in testing but this gets us past initial import errors.

Thanks -- Andy

Andy Grover (3):
Add nvmetcli to setup.py scripts
Use relative import in nvmet/__init__.py
nvmetcli: Fix nvmet import

 nvmet/__init__.py | 2 +-
 nvmetcli          | 2 +-
 setup.py          | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/3 Add nvmetcli to setup.py scripts

This results in nvmetcli being placed in the right place on install, and the interpreter name will be changed to the current interpreter name, which may be different, e.g. /usr/bin/python3.

Signed-off-by Andy Grover <agrover at redhat.com>
---
 setup.py | 1 +
 1 file changed, 1 insertion(+)
setup.py +1 -0
index 078020f..f62ce5b 100755
@@ -27,4 +27,5 @@ setup(
     maintainer_email = 'hch at lst.de',
     test_suite='nose2.collector.collector',
     packages = ['nvmet'],
+    scripts = ['nvmetcli'],
     )
Signature · 1 line
2.7.4
#5 lore raw

PATCH 2/3 Use relative import in nvmet/__init__.py

In reply to Andy Grover

This is supported by Python 2.7 and later.

Signed-off-by Andy Grover <agrover at redhat.com>
---
 nvmet/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
nvmet/__init__.py +1 -1
index eba0ebb..a084151 100644
@@ -1 +1 @@
-from nvme import Root, Subsystem, Namespace
+from .nvme import Root, Subsystem, Namespace
Signature · 1 line
2.7.4
#6 lore raw

PATCH 3/3 nvmetcli: Fix nvmet import

In reply to Andy Grover

We should just need to import nvmet, which will run __init__.py and import just the public things from nvmet/nvme.py.

Signed-off-by Andy Grover <agrover at redhat.com>
---
 nvmetcli | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
nvmetcli +1 -1
index a318aa6..8140fc6 100755
@@ -23,7 +23,7 @@ from __future__ import print_function
 import os
 import sys
 import configshell_fb as configshell
-import nvmet.nvme as nvme
+import nvmet as nvme
 
 
 class UINode(configshell.node.ConfigNode):
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/3 Add nvmetcli to setup.py scripts

In reply to Andy Grover
Quoted 5 lines · Andy Grover

This results in nvmetcli being placed in the right place on install, and the interpreter name will be changed to the current interpreter name, which may be different, e.g. /usr/bin/python3.

Signed-off-by Andy Grover <agrover at redhat.com>

It installs it into the wrong place unfortunately, /usr/bin instead of /usr/sbin.

#7 lore raw

cover nvmetcli fixes

In reply to Andy Grover
Quoted 4 lines · Andy Grover

Here are some small fixes that help packaging nvmetcli, and help it minimally work with Python 3 -- there are likely more Py2/3 issues that will come out in testing but this gets us past initial import errors.

Thanks Andy, I've applied patches 2 and 3. Any idea how to get nvmetcli installed to /usr/sbin using setuptools?

#3 lore raw

PATCH 1/3 Add nvmetcli to setup.py scripts

In reply to Christoph Hellwig
Quoted 9 lines · Christoph Hellwig
Quoted 5 lines · Andy Grover

This results in nvmetcli being placed in the right place on install, and the interpreter name will be changed to the current interpreter name, which may be different, e.g. /usr/bin/python3.

Signed-off-by Andy Grover <agrover at redhat.com>

It installs it into the wrong place unfortunately, /usr/bin instead of /usr/sbin.

There's a command-line argument to 'python setup.py install', --install-scripts, that can be used to put it in /usr/sbin if you want...

-- Andy

#4 lore raw

PATCH 1/3 Add nvmetcli to setup.py scripts

Quoted 6 lines · Andy Grover
Quoted 5 lines · Christoph Hellwig
Quoted 4 lines · Andy Grover

This results in nvmetcli being placed in the right place on install, and the interpreter name will be changed to the current interpreter name, which may be different, e.g. /usr/bin/python3.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Andy Grover <agrover at redhat.com>

It installs it into the wrong place unfortunately, /usr/bin instead of /usr/sbin.

There's a command-line argument to 'python setup.py install', --install-scripts, that can be used to put it in /usr/sbin if you want...

Can you fix up the specfile to use it? I'll take care of the Debian packaging then.