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

Output maf version number with "--mafversion" #96

Merged
merged 8 commits into from
Jan 13, 2015

Conversation

hiroshinoji
Copy link
Contributor

Incomplete implementation for #89.

Currently maf.py obtain the revision number of git, but now maflib cannot access to it.
We have to implement core.ExpOptionsContext.init. The version is now a constant of in maf.py, but we cannot access this number from maflib. Maybe we have to make an auto generated file in .waf-*/maflib directory to save some constants.

@hiroshinoji
Copy link
Contributor Author

Currently it is partly working but not complete.

To check version numbers, core.py has constants MAFVERSION and MAFREVISION which are inserted by generate_maf.py. These versions are checked in maf.py when loading. generate_maf.py also assigns version numbers to maf.py so these should be consistent.

The current problem is, when using maf in the git repository (where maflib exist) core.py is loaded from not hidden directory (.waf-.../maflib) but the maflibdirectory. The original maflib/core.py doesn't have version numbers so it cannot load version numbers correctly.

@hiroshinoji
Copy link
Contributor Author

The problem above is rather complicated. First, I found a snippet in waflib where sys.path is written temporarily during executing main waf logic:
http://docs.waf.googlecode.com/git/apidocs_17/_modules/waflib/Context.html#load_module

For this, when loading maf.py, maflib/core.py has a precedence over .waf-*/maflib/core.py.

We skip this problem by not checking version in maf.py if the user is probably developing maflib. If the loaded version is not filled, that means maflib is loaded from the current directory, in that case we assume the user is developing maflib.

@beam2d
Copy link
Member

beam2d commented Jan 13, 2015

Thanks for supporting versioning. LGTM with one comment.

If one migrates from old version that does not define MAFVERSION to the new version with MAFVERSION, an exception AttributeError: 'module' object has no attribute 'MAFVERSION' occurs. It should be more verbose (e.g. catch it and print some verbose message).

@beam2d
Copy link
Member

beam2d commented Jan 13, 2015

LGTM!

@beam2d beam2d merged commit 7115acd into pfi:develop Jan 13, 2015
@hiroshinoji hiroshinoji deleted the feature/mafversion branch March 20, 2015 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants