-
Notifications
You must be signed in to change notification settings - Fork 47
Align the python-libjuju dependency with the installed juju version #677
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |
| from __future__ import print_function | ||
|
|
||
| import os | ||
| import subprocess | ||
| import sys | ||
| from setuptools import setup, find_packages | ||
| from setuptools.command.test import test as TestCommand | ||
|
|
@@ -50,7 +51,22 @@ | |
| if os.environ.get("TEST_JUJU3"): | ||
| install_require.append('juju') | ||
| else: | ||
| install_require.append('juju<3.0.0') | ||
| try: | ||
| version = subprocess.check_output(['juju', '--version'], | ||
| universal_newlines=True).strip() | ||
| print('juju --version ->', version) | ||
| if int(version.split(.)[0]) >= 3: | ||
| (major, minor) = version.split('.')[0:2] | ||
| major = int(major) | ||
| minor = int(minor) | ||
| juju_ver_n = "%s.%s" % (major, minor) | ||
| juju_ver_n1 = "%s.%s" % (major, minor + 1) | ||
| install_require.append('juju>=%s,<%s' % (juju_ver_n, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am sceptical about using We need to check with juju team if they really follows what they mentioned in documentation [1] to use [1] https://canonical-juju.readthedocs-hosted.com/en/latest/user/reference/juju/juju-cross-version-compatibility/#juju-cli-controllers-and-ref-agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd expect libjuju to significantly lag behind juju for new major versions. But then, running e.g. libjuju 3.x with juju 4.x is likely to run into compatibility issues, so I'm thinking failing the run for major version mismatches might be a good decision anyway. Wonder if the version parsing should be made more robust to better handle version string format changes or double-digit versions though.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I pushed a new revision of that patch with a more reasonable parsing. |
||
| juju_ver_n1)) | ||
| else: | ||
| install_require.append('juju<3.0.0') | ||
| except (FileNotFoundError, subprocess.CalledProcessError): | ||
| install_require.append('juju<3.0.0') | ||
|
|
||
| tests_require = [ | ||
| 'tox >= 2.3.1', | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fail whenever minor version cropped into double digit like 4.10
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that will make that piece of code fail:
I did fix this line though -> https://github.com/openstack-charmers/zaza/compare/56c4edb7dee667ed7169f2ae4ed5688ec59afb4f..cb31096758c3f56aac13b06dafe93b3e942cd949
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AAh such a silly mistake from me, you are right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing
''for.in the new change