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

"--skip_validate" arg for xls2xform.py #63

Merged
merged 3 commits into from
May 3, 2016

Conversation

lindsay-stevens
Copy link
Contributor

c758940 Exposes the existing option in survey.print_xform_to_file to not run ODK_Validate on the output XML file, as an optional argument "--skip_validate" on the command line.

  • Allows packaging the xls2xform.py script as onefile pyinstaller exe for easy distribution. (I can provide this if there is interest, it's just ```pyinstaller xls2xform.py --onefile".
  • ODK_Validate can still be run as a separate step; sorting out the java side of things is easier for less technical users that way.

94c759c Before I could get started on this there were a couple of Windows-specific problems preventing the nosetests from running. In each case I've tried to make it so that the original behaviour will be attempted, then try the Windows route, and then fail after that. All the tests pass for me on Windows 7 x64 with these changes. It's passing in travis-ci so I guess it's Linux compatible too. https://travis-ci.org/lindsay-stevens/pyxform/builds/126578491.

a57ab51 I also had trouble with the bundled ODK_Validate.jar; when running the tests, the java -jar call would error out with NoClassDefFound exceptions. I think it is something to do with the "jar inside a jar" structure. So I re-packaged it from the validate repo as of 2016-04-29 getodk/validate@65444de and it worked.

These changes were required to get all nosetests to pass.
- Java installed check falls back to Windows-specific method on WindowsError.
- Parsing stderr from the ODK Validate call falls back to latin-1 on UnicodeDecodeError.
- Exclusive NamedTemporaryFile handling since Windows doesn't allow simultaneous access.
Bundled version doesn't seem to work with Popen calls.
- OK: double-click jar and validate xml file.
- Not OK: running nosetests using validate, these fail with java NoClassDefFound exceptions.

The included jar is a fresh ant build using jdk1.7.0_80, and works in both above contexts.
- packaged from getodk/validate@65444de
 - This hooks in to existing option in print_xform_to_file so no tests for how it reacts to True or False
 - New _create_parser function wraps parser creation for testability.
 - Other __main__ code put inside a wrapper function to keep the module namespace tidy.
@dorey
Copy link
Contributor

dorey commented May 3, 2016

@lindsay-stevens, thank you for getting this working in windows.

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