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
DM-3372: Provenance support #5
Conversation
return version | ||
|
||
def getPythonPackages(): | ||
"""Provide a dict of imported python packages and their versions |
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.
First time I read this I thought it was telling me that I was supposed to give a dict as an argument to the function. I think using "Provides" rather than "Provide" would avoid that confusion, or alternatively "Return" if the tense is a problem..
80596ef
to
1fe6f69
Compare
# we don't tend to run "scons" every time we update some python file, and even if we did sconsUtils | ||
# probably doesn't check to see if the repo is clean). | ||
for prod in products: | ||
if not prod.version.startswith(Product.Product.LocalVersionPrefix): |
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 think there are too many Products in there. Breaks on my laptop unless I remove one of them and use Product.LocalVersionPrefix
.
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.
Hmph. It broke on Jenkins without both of them. I'll see if I can find a middle road.
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.
>>> from eups import Product
>>> Product.LocalVersionPrefix
'LOCAL:'
OK, give that a whirl. |
Everything now builds on my Mac so that's good. I'm somewhat concerned that there are no tests for this functionality in |
This attempts to provide a platform-independent interface to dlopen and dlsym.
We get the versions by loading a dynamic library and pulling out the appropriate symbol. Includes support for getting the versions of cfitsio, fftw, wcslib, gsl.
5afbc60
to
8661b51
Compare
if __name__ == "__main__": | ||
run(True) | ||
sys.exit(unittest.TextTestRunner().run(suite()).wasSuccessful()) |
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.
Why can't this all be unittest.main()
? suite
s are deprecated.
Here's a fixup to address the latest comments. |
self.assertDictEqual(new.difference(packages), {}) | ||
self.assertDictEqual(new.missing(packages), {}) # Nothing in 'new' that's not in 'packages' | ||
extra = new.extra(packages) | ||
self.assertNotEqual(len(extra), 0) # 'new' has extra stuff compared to 'packages' |
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.
assertGreater as well I guess.
The tests now pass on my Mac with |
Ready to merge (after rebasing)? |
Probably. I'm actually waiting for my build to get as far as pipe_base... |
OK. I just fired off Jenkins again, just in case. "What, race?" |
By iterating with sys.modules.iteritems(), we're subject to a race condition: if there's another thread (e.g., in scons) that does an import, sys.modules will change while we're iterating over it.
Unfortunately, we're somewhat limited in what we can test because we only get the versions of things being used at runtime, and this package sits rather low in the dependency chain so there's not usually a lot of other packages available when this test gets run. Therefore some of the tests are only checking that things don't explode, since they are incapable of testing much more than that. But better that than nothing.
c219a4b
to
5b85112
Compare
No description provided.