Copy CP2K provided basis set directory to installdir, and use it#996
Merged
boegel merged 5 commits intoeasybuilders:developfrom Jan 17, 2017
Merged
Copy CP2K provided basis set directory to installdir, and use it#996boegel merged 5 commits intoeasybuilders:developfrom
boegel merged 5 commits intoeasybuilders:developfrom
Conversation
boegel
requested changes
Sep 20, 2016
| try: | ||
| shutil.copytree(datadir, targetdir) | ||
| except: | ||
| raise EasyBuildError("Copying tests from %s to %s failed", srctests, targetdir) |
Member
There was a problem hiding this comment.
@hajgato positive logic is easier to follow, srctests doesn't exist, please use except OSError and include actual error in error message, so:
if os.path.exists(targetdir):
self.log.info("Won't copy data dir. Destination directory %s already exists", targetdir)
elif os.path.exists(datadir):
try:
shutil.copytree(datadir, targetdir)
except OSError as err:
raise EasyBuildError("Copying tests from %s to %s failed: %s", datadir, targetdir, err)
else:
self.log.info("Won't copy data dir. Source directory %s does not exist", datadir)| txt = super(EB_CP2K, self).make_module_extra() | ||
| if os.path.exists(os.path.join(self.installdir, 'data')): | ||
| txt += self.module_generator.set_environment('CP2K_DATA_DIR', | ||
| os.path.join(self.installdir, 'data')) |
Member
There was a problem hiding this comment.
@hajgato if you need a value multiple times, it's cleaner to just construct it once:
data_dir = os.path.join(self.installdir, 'data')
if os.path.exists(data_dir):
txt += self.module_generator.set_environment('CP2K_DATA_DIR', data_dir)
hajgato
commented
Sep 21, 2016
Collaborator
Author
hajgato
left a comment
There was a problem hiding this comment.
requested changes implemented
boegel
requested changes
Nov 13, 2016
| try: | ||
| shutil.copytree(datadir, targetdir) | ||
| except: | ||
| raise EasyBuildError("Copying data dir from %s to %s failed", srctests, targetdir) |
Member
There was a problem hiding this comment.
@hajgato this is still wrong, where does srctests come from, this should be datadir?
also, mention the error in the message:
except OSError as err:
raise EasyBuildError("Copying data dir from %s to %s failed", datadir, targetdir)
Collaborator
Author
There was a problem hiding this comment.
@boegel It comes from copy paste ;)
Anyway, I corrected it
boegel
approved these changes
Jan 10, 2017
Member
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.