-
Notifications
You must be signed in to change notification settings - Fork 219
Fix UTF-8 encoding errors when running EasyBuild with Python 3.0.x-3.6.x #3565
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
91ce621
Add tests reproducing failure in handling UTF-8 files
Flamefire c276626
Fix failures on handling UTF-8 files in read_file, write_file and app…
Flamefire 64451f4
Make sure all calls to open are correct and close is always called
Flamefire 37671fb
Make sure the logging handler uses UTF-8 too
Flamefire 0bc7b80
Add only 1 extra run for LC_ALL=C tests
Flamefire 039e9ce
Replace single letter variables and improve comments
Flamefire 284167d
Avoid reading the file more often than required
Flamefire b0d56bb
Rename _open to open_file
Flamefire 7004eb1
use write_file function in Lmod.update
boegel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,7 +46,7 @@ | |
| from easybuild.tools.config import EBROOT_ENV_VAR_ACTIONS, LOADED_MODULES_ACTIONS | ||
| from easybuild.tools.config import build_option, get_modules_tool, install_path | ||
| from easybuild.tools.environment import ORIG_OS_ENVIRON, restore_env, setvar, unset_env_vars | ||
| from easybuild.tools.filetools import convert_name, mkdir, path_matches, read_file, which | ||
| from easybuild.tools.filetools import convert_name, mkdir, path_matches, read_file, which, write_file | ||
| from easybuild.tools.module_naming_scheme.mns import DEVEL_MODULE_SUFFIX | ||
| from easybuild.tools.py2vs3 import subprocess_popen_text | ||
| from easybuild.tools.run import run_cmd | ||
|
|
@@ -1403,17 +1403,12 @@ def update(self): | |
| # don't actually update local cache when testing, just return the cache contents | ||
| return stdout | ||
| else: | ||
| try: | ||
| cache_fp = os.path.join(self.USER_CACHE_DIR, 'moduleT.lua') | ||
| self.log.debug("Updating Lmod spider cache %s with output from '%s'" % (cache_fp, ' '.join(cmd))) | ||
| cache_dir = os.path.dirname(cache_fp) | ||
| if not os.path.exists(cache_dir): | ||
| mkdir(cache_dir, parents=True) | ||
| cache_file = open(cache_fp, 'w') | ||
| cache_file.write(stdout) | ||
| cache_file.close() | ||
| except (IOError, OSError) as err: | ||
| raise EasyBuildError("Failed to update Lmod spider cache %s: %s", cache_fp, err) | ||
| cache_fp = os.path.join(self.USER_CACHE_DIR, 'moduleT.lua') | ||
| self.log.debug("Updating Lmod spider cache %s with output from '%s'" % (cache_fp, ' '.join(cmd))) | ||
| cache_dir = os.path.dirname(cache_fp) | ||
| if not os.path.exists(cache_dir): | ||
| mkdir(cache_dir, parents=True) | ||
|
Comment on lines
+1408
to
+1410
Contributor
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. FTR: write_file already does this |
||
| write_file(cache_fp, stdout) | ||
|
|
||
| def use(self, path, priority=None): | ||
| """ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.