This request was made by Fabrice Bacchella in the users mailing list. Quoting him: I'm trying to install ovirt-shell on my mac, as explained in http://www.ovirt.org/CLI#pypi , but if fails : $ virtualenv-2.7 ovirt New python executable in ovirt/bin/python Installing setuptools, pip, wheel...done. $ ./ovirt/bin/easy_install ovirt-shell Searching for ovirt-shell Reading https://pypi.python.org/simple/ovirt-shell/ Best match: ovirt-shell 3.5.0.6 ... Finished processing dependencies for ovirt-shell $ ./ovirt/bin/ovirt-shell Traceback (most recent call last): File "./ovirt/bin/ovirt-shell", line 9, in <module> load_entry_point('ovirt-shell==3.5.0.6', 'console_scripts', 'ovirt-shell')() File "/private/tmp/ovirt/lib/python2.7/site-packages/pkg_resources/__init__.py", line 552, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/private/tmp/ovirt/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2672, in load_entry_point return ep.load() File "/private/tmp/ovirt/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2345, in load return self.resolve() File "/private/tmp/ovirt/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2351, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "build/bdist.macosx-10.10-x86_64/egg/ovirtcli/main.py", line 19, in <module> File "build/bdist.macosx-10.10-x86_64/egg/ovirtcli/infrastructure/options.py", line 21, in <module> File "build/bdist.macosx-10.10-x86_64/egg/ovirtcli/infrastructure/settings.py", line 18, in <module> File "build/bdist.macosx-10.10-x86_64/egg/cli/__init__.py", line 3, in <module> File "build/bdist.macosx-10.10-x86_64/egg/cli/context.py", line 34, in <module> ImportError: cannot import name Terminal
This is related to the fact that in several places we check the content of the Python "sys.platform" variable, and then we take into account the values "linux2" and "win32", but not "darwin" (I believe this is the value in Mac OS). We may need to change the following files in order to do the same for "linux2" and "darwin": src/cli/platform/__init__.py src/ovirtcli/platform/__init__.py src/ovirtcli/platform/windows/__init__.py Not sure if this will have a positive effect, as I don't have a Mac OS environment to test it.
Yes, after the recommended modification, I was able to use use ovirt-shell and connect to the ovirt server. But I got warning: WARNING: Couldn't write lextab module 'cli.parser_lex'. [Errno 20] Not a directory: '/tmp/ovirt/lib/python2.7/site-packages/ovirt_shell-3.5.0.6-py2.7.egg/cli/parser_lex.py' WARNING: Couldn't create 'cli.parser_tab'. [Errno 20] Not a directory: '/tmp/ovirt/lib/python2.7/site-packages/ovirt_shell-3.5.0.6-py2.7.egg/cli/parser_tab.py' and indeed : $ ls -l /tmp/ovirt/lib/python2.7/site-packages/ovirt_shell-3.5.0.6-py2.7.egg -rw-r----- 1 fa4 wheel 279861 Aug 20 16:28 /tmp/ovirt/lib/python2.7/site-packages/ovirt_shell-3.5.0.6-py2.7.egg The egg is a zip file. My python version: $ ./ovirt/bin/python -V Python 2.7.10 I installed ovirt-shell using virtualenv. Both '/tmp/ovirt/bin/easy_install ovirt-shell' and '/tmp/ovirt/bin/python setup.py install' generated a egg as a zip file.
OK, then we need to find a way to generate the parse tables during the build process, and include them in the source tarball, so that parser won't try to generate them during runtime.
I think that the two attached patches should improve the situation, as the the CLI will do the same for "darwin" than for "linux2" and the parsing tables should be generated during build time. Can you test it? Should be something like this: # git clone git://gerrit.ovirt.org/ovirt-engine-cli # cd ovirt-engine-cli # git fetch git://gerrit.ovirt.org/ovirt-engine-cli refs/changes/60/45160/1 && git checkout FETCH_HEAD # python setup.py install
generating parsing tables .... ImportError: No module named kitchen.text.converters After installing kitchen, and ply too, I got : $ /tmp/ovirt/bin/python setup.py install ... generating parsing tables WARNING: Couldn't write lextab module 'parser_lex'. [Errno 2] No such file or directory: 'build/lib/cli/parser_lex.py' error: source code not available build/lib/cli/ exists, but there is no parser_lex.py in it.
I think this happens because you are using a newer version of ply, probably 3.6. I'm using 3.4, and it has a limitation regarding the location of the source files: it puts them always in the current working directory, unless explicitly told to put them in a specific directory. We used to work this around changing the current working directory explicitly, but this doesn't work with 3.6. I have changed the code so that the output directory is passed explicitly, this should work correctly with 3.4 and 3.6. Please try again: # git fetch git://gerrit.ovirt.org/ovirt-engine-cli refs/changes/60/45160/1 && git checkout FETCH_HEAD You may want to create a gerrit.ovirt.org account and comment on the patches: https://gerrit.ovirt.org/#/q/topic:macos
The fetch command in the previous comment is wrong, should be like this: # git fetch git://gerrit.ovirt.org/ovirt-engine-cli refs/changes/60/45160/4 && git checkout FETCH_HEAD
Now I'm getting: ... generating parsing tables creating build/bdist.macosx-10.10-x86_64 ... So this step is good, but latter I got: Processing dependencies for ovirt-shell==3.6.0.0rc4 Searching for ovirt-engine-sdk-python>=3.6.0.0preview0 Reading https://pypi.python.org/simple/ovirt-engine-sdk-python/ No local packages or download links found for ovirt-engine-sdk-python>=3.6.0.0preview0 error: Could not find suitable distribution for Requirement.parse('ovirt-engine-sdk-python>=3.6.0.0preview0') And this project is not publicly available in gerrit: git clone git://gerrit.ovirt.org/ovirt-engine-sdk-python Cloning into 'ovirt-engine-sdk-python'... fatal: Could not read from remote repository. So I can't check any further.
Now I'm getting : /tmp/ovirt/lib/python2.7/site-packages/pkg_resources/__init__.py:197: RuntimeWarning: You have iterated over the result of pkg_resources.parse_version. This is a legacy behavior which is inconsistent with the new version class introduced in setuptools 8.0. In most cases, conversion to a tuple is unnecessary. For comparison of versions, sort the Version instances directly. If you have another use case requiring the tuple, please file a bug with the setuptools project describing that need. stacklevel=1, And display is strange : [oVirt shell ([1;32mconnected[1;m)] But I'm connected. For information, the step to build my virtualenv are virtualenv-2.7 ovirt ./ovirt/bin/easy_install ply ./ovirt/bin/easy_install kitchen PYCURL_SSL_LIBRARY=openssl ./ovirt/bin/easy_install pycurl git clone git://gerrit.ovirt.org/ovirt-engine-sdk (cd ovirt-engine-sdk && ../ovirt/bin/python setup.py install) git clone git://gerrit.ovirt.org/ovirt-engine-cli (cd ovirt-engine-cli && git fetch git://gerrit.ovirt.org/ovirt-engine-cli refs/changes/60/45160/4 && git checkout FETCH_HEAD && ../ovirt/bin/python setup.py install)
(In reply to Fabrice Bacchella from comment #9) > Now I'm getting : > /tmp/ovirt/lib/python2.7/site-packages/pkg_resources/__init__.py:197: > RuntimeWarning: You have iterated over the result of > pkg_resources.parse_version. This is a legacy behavior which is inconsistent > with the new version class introduced in setuptools 8.0. In most cases, > conversion to a tuple is unnecessary. For comparison of versions, sort the > Version instances directly. If you have another use case requiring the > tuple, please file a bug with the setuptools project describing that need. > stacklevel=1, > When do you get this error? When building or when running?
When running.
We do call the "parse_version" function, but I think that we don't iterate the result. It is hard to tell where this is happening. Can you modify your /tmp/ovirt/lib/python2.7/site-packages/pkg_resources/__init__.py file (temporarely) and add these two lines right before that warning is generated? # Add these two lines: import traceback traceback.print_stack() # Right before this: # Warn for use of this function warnings.warn( "You have iterated .... ) Then repeat the test, it will hopefully give us some information of what is causing this issue.
Regarding the strange display that happens because your terminal isn't honouring the ANSI color escape codes. That is strange, because most terminals support that these days. What kind of terminal are you using? What is the value of the TERM environment variable? As a workaround you can modify the ovirtcli/utils/colorhelper.py file, and replace the "if color" with "if False": def colorize(...): """...""" if False: # Instead of "if color" ... return text
my term is xterm-256color The stack: File "ovirt/bin/ovirt-shell", line 9, in <module> load_entry_point('ovirt-shell==3.6.0.0rc4', 'console_scripts', 'ovirt-shell')() File "build/bdist.macosx-10.10-x86_64/egg/ovirtcli/main.py", line 38, in main shell.onecmd_loop() File "build/bdist.macosx-10.10-x86_64/egg/ovirtcli/shell/engineshell.py", line 339, in onecmd_loop self.do_connect('') File "build/bdist.macosx-10.10-x86_64/egg/ovirtcli/shell/connectcmdshell.py", line 42, in do_connect self.context.execute_string(ConnectCmdShell.NAME + ' ' + args + '\n') File "build/lib/cli/context.py", line 204, in execute_string self._execute_command(command) File "build/lib/cli/context.py", line 424, in _execute_command command.run(self) File "build/bdist.macosx-10.10-x86_64/egg/cli/command/command.py", line 101, in run self.execute() File "build/bdist.macosx-10.10-x86_64/egg/ovirtcli/command/connect.py", line 144, in execute if self.context.sdk_version < MIN_FORCE_CREDENTIALS_CHECK_VERSION: File "/private/tmp/ovirt/lib/python2.7/site-packages/pkg_resources/__init__.py", line 112, in __lt__ return tuple(self) < other File "/private/tmp/ovirt/lib/python2.7/site-packages/pkg_resources/__init__.py", line 188, in __iter__ traceback.print_stack() /private/tmp/ovirt/lib/python2.7/site-packages/pkg_resources/__init__.py:201: RuntimeWarning: You have iterated over the result of pkg_resources.parse_version. This is a legacy behavior which is inconsistent with the new version class introduced in setuptools 8.0. In most cases, conversion to a tuple is unnecessary. For comparison of versions, sort the Version instances directly. If you have another use case requiring the tuple, please file a bug with the setuptools project describing that need. stacklevel=1,
OK, apparently the warning is caused by a version comparison that we do with a tuple. Fortunately we don't need to do that comparison, so I removed it: cli: Don't check for old version of the SDK https://gerrit.ovirt.org/45189
The ovirt.org has been re-organized. The page that describes the CLI: http://www.ovirt.org/develop/release-management/features/infra/cli
The fixes for this bug have been merged to the master branch, but there won't be a release from the master branch for version 4.0 of oVirt.
Moving to new, as we don't plan to release a new cli.
(In reply to Oved Ourfali from comment #18) > Moving to new, as we don't plan to release a new cli. So CLOSED-WONTFIX?