|
3 | 3 | Copy all relevant .c and .h files from Python-C, if they are newer. |
4 | 4 |
|
5 | 5 | This is a simple utility, to be run from this directory. It assumes that |
6 | | -an up-to-date GSW-C github repo and the present GSW-Python repo are |
| 6 | +an up-to-date GSW-C GitHub repo and the present GSW-Python repo are |
7 | 7 | siblings in the directory tree. |
8 | 8 | """ |
9 | 9 |
|
| 10 | +import sys |
10 | 11 | import shutil |
11 | 12 | from pathlib import Path |
12 | 13 |
|
| 14 | +current = Path(__file__).parent |
| 15 | +srcdir = Path(current.parent.parent, "GSW-C") |
13 | 16 |
|
14 | | -fnames = ['gsw_oceanographic_toolbox.c', |
15 | | - 'gsw_saar.c', |
16 | | - 'gsw_saar_data.h', |
17 | | - 'gsw_internal_const.h', |
18 | | - 'gswteos-10.h'] |
| 17 | +destdir = Path(current.parent, "src", "c_gsw") |
| 18 | + |
| 19 | +fnames = [ |
| 20 | + "gsw_oceanographic_toolbox.c", |
| 21 | + "gsw_saar.c", |
| 22 | + "gsw_saar_data.h", |
| 23 | + "gsw_internal_const.h", |
| 24 | + "gswteos-10.h", |
| 25 | + ] |
19 | 26 |
|
20 | | -srcdir = Path('..', '..', 'GSW-C') |
21 | | -destdir = Path('..', 'src', 'c_gsw') |
22 | 27 |
|
23 | 28 | if not srcdir.exists(): |
24 | 29 | raise IOError( |
25 | | - f"Could not find the GSW-C source code in {srcdir}." |
| 30 | + f"Could not find the GSW-C source code in {srcdir}. " |
26 | 31 | "Please read the development notes to find how to setup your GSW-Python development environment." |
27 | 32 | ) |
28 | 33 |
|
|
31 | 36 | dest = destdir.joinpath(fname) |
32 | 37 | if src.stat().st_mtime > dest.stat().st_mtime: |
33 | 38 | shutil.copyfile(str(src), str(dest)) |
34 | | - print('copied %s to %s' % (src, dest)) |
| 39 | + print(f"copied {src} to {dest}") |
0 commit comments