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

refactor(get-modflow): use Path.replace instead of Path.rename #1822

Merged
merged 1 commit into from Jun 8, 2023

Conversation

wpbonelli
Copy link
Contributor

@wpbonelli wpbonelli commented Jun 8, 2023

The behavior of Path.rename() is inconsistent between platforms: on Windows an error is raised if a file with the new name already exists, while on Linux and macOS the file is silently replaced. This PR updates get-modflow to use Path.replace() instead of Path.rename() when moving binaries from the download directory to bin directory, for consistent behavior.

One case for which this is relevant is installing a full suite of binaries from the executables distribution, plus bleeding-edge versions of mf6, mf5to6, mf2005, and zbud6 from the modflow6-nightly-build distribution. An easy way to do this is running get-modflow twice, e.g.

get-modflow bin
get-modflow bin --repo modflow6-nightly-build

Currently this works on macOS and Linux but not on Windows.

@codecov
Copy link

codecov bot commented Jun 8, 2023

Codecov Report

Merging #1822 (e7804c0) into develop (63ea5fc) will increase coverage by 0.0%.
The diff coverage is 100.0%.

@@           Coverage Diff           @@
##           develop   #1822   +/-   ##
=======================================
  Coverage     72.0%   72.0%           
=======================================
  Files          255     255           
  Lines        57369   57363    -6     
=======================================
- Hits         41340   41336    -4     
+ Misses       16029   16027    -2     
Impacted Files Coverage Δ
flopy/utils/get_modflow.py 64.1% <100.0%> (ø)

... and 2 files with indirect coverage changes

@jdhughes-usgs jdhughes-usgs merged commit 0deb8f6 into modflowpy:develop Jun 8, 2023
21 checks passed
@wpbonelli wpbonelli deleted the get-modflow branch June 8, 2023 20:56
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.

None yet

2 participants