pygtide 0.8.0__tar.gz → 0.8.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. pygtide-0.8.1/MANIFEST.in +4 -0
  2. {pygtide-0.8.0/pygtide.egg-info → pygtide-0.8.1}/PKG-INFO +1 -1
  3. pygtide-0.8.1/build_pygtide_abi.py +47 -0
  4. pygtide-0.8.1/meson.build +74 -0
  5. {pygtide-0.8.0 → pygtide-0.8.1/pygtide.egg-info}/PKG-INFO +1 -1
  6. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide.egg-info/SOURCES.txt +4 -2
  7. {pygtide-0.8.0 → pygtide-0.8.1}/pyproject.toml +2 -3
  8. pygtide-0.8.1/setup.py +40 -0
  9. pygtide-0.8.1/src/etpred.f90 +3529 -0
  10. pygtide-0.8.0/MANIFEST.in +0 -3
  11. pygtide-0.8.0/pygtide/etpred.so +0 -0
  12. pygtide-0.8.0/setup.py +0 -35
  13. {pygtide-0.8.0 → pygtide-0.8.1}/LICENSE +0 -0
  14. {pygtide-0.8.0 → pygtide-0.8.1}/README.md +0 -0
  15. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/__init__.py +0 -0
  16. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/commdat/[raw]_Leap_Second_History.dat +0 -0
  17. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/commdat/[raw]_eopc04_IAU2000.dat +0 -0
  18. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/commdat/[raw]_finals2000A.dat +0 -0
  19. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/commdat/buellehw.dat +0 -0
  20. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/commdat/cted73hw.dat +0 -0
  21. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/commdat/doodsehw.dat +0 -0
  22. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/commdat/etddt.dat +0 -0
  23. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/commdat/etddt_tmpl.dat +0 -0
  24. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/commdat/etpolut1.dat +0 -0
  25. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/commdat/hw95s.dat +0 -0
  26. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/commdat/ksm03.dat +0 -0
  27. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/commdat/ratgp95.dat +0 -0
  28. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/commdat/tamurahw.dat +0 -0
  29. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/commdat/xi1989hw.dat +0 -0
  30. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/core.py +0 -0
  31. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/tests.py +0 -0
  32. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide/update_etpred_data.py +0 -0
  33. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide.egg-info/dependency_links.txt +0 -0
  34. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide.egg-info/requires.txt +0 -0
  35. {pygtide-0.8.0 → pygtide-0.8.1}/pygtide.egg-info/top_level.txt +0 -0
  36. {pygtide-0.8.0 → pygtide-0.8.1}/setup.cfg +0 -0
@@ -0,0 +1,4 @@
1
+ include README.md
2
+ include build_pygtide_abi.py
3
+ include meson.build
4
+ include src/etpred.f90
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygtide
3
- Version: 0.8.0
3
+ Version: 0.8.1
4
4
  Summary: A Python module and wrapper for ETERNA PREDICT to compute gravitational tides on Earth
5
5
  Author: Tom Eulenfeld
6
6
  Author-email: "Gabriel C. Rau" <gabriel@hydrogeo.science>
@@ -0,0 +1,47 @@
1
+ import subprocess
2
+ import shutil
3
+ import os
4
+ import glob
5
+ import sys
6
+
7
+
8
+ def build():
9
+ # --- Configuration ---
10
+ print('Start Meson build')
11
+ build_dir = 'build_abi'
12
+ ext = 'pyd' if os.name == 'nt' else 'so'
13
+
14
+ # --- Step 1: Setup Meson build directory ---
15
+ if os.path.exists(build_dir):
16
+ print(f"Build directory '{build_dir}' already exists, skipping setup.")
17
+ else:
18
+ print(f"Setting up Meson build directory '{build_dir}'...")
19
+ subprocess.check_call(['meson', 'setup', build_dir])
20
+ # --- Step 2: Compile Meson targets ---
21
+ print("Compiling Meson targets...")
22
+ subprocess.check_call(['meson', 'compile', '-C', build_dir])
23
+
24
+ # --- Step 3: Copy ABI module to pygtide/ ---
25
+ print("Locating ABI module in build directory...")
26
+ build_path = os.path.abspath(build_dir)
27
+ pattern = os.path.join(build_path, '**', f'etpred*.{ext}')
28
+ matches = glob.glob(pattern, recursive=True)
29
+
30
+ if not matches:
31
+ print("ERROR: ABI module not found! Did Meson compile succeed?")
32
+ sys.exit(1)
33
+
34
+ dst = os.path.join(os.path.abspath('.'), 'pygtide', f'etpred.{ext}')
35
+ shutil.copy(matches[0], dst)
36
+ print(f"Copied ABI module {matches[0]} -> {dst}")
37
+
38
+ # --- Step 4: Clean up build directory ---
39
+ print(f"Deleting build directory '{build_dir}'...")
40
+ shutil.rmtree(build_dir)
41
+ print("Meson build complete!")
42
+
43
+ #print("\nNext step: run 'pip install .' or 'pip install -e .' to install the package.")
44
+
45
+
46
+ if __name__ == '__main__':
47
+ build()
@@ -0,0 +1,74 @@
1
+ project('pygtide', 'fortran',
2
+ version : '0.8.1',
3
+ meson_version : '>=1.1.0',
4
+ )
5
+
6
+ py = import('python').find_installation()
7
+
8
+ host_os = host_machine.system()
9
+ fc = meson.get_compiler('fortran')
10
+
11
+ if host_os == 'windows'
12
+ ext = 'pyd'
13
+ if fc.get_id() == 'msvc'
14
+ f90flags = ['/O2']
15
+ else
16
+ f90flags = ['-O3']
17
+ endif
18
+ else
19
+ ext = 'so'
20
+ f90flags = ['-fPIC', '-O3']
21
+ endif
22
+
23
+ src = 'src/etpred.f90'
24
+ f90_flag_args = ['--f90flags=' + ' '.join(f90flags)]
25
+
26
+ # --------------------------------------------------
27
+ # 1. Build f2py (ABI-tagged output)
28
+ # --------------------------------------------------
29
+ etpred_build = custom_target(
30
+ 'etpred_build',
31
+ input : src,
32
+ output : 'etpred.build.stamp',
33
+ command : [
34
+ py,
35
+ '-m', 'numpy.f2py',
36
+ '-c',
37
+ ] + f90_flag_args + [
38
+ '-m', 'etpred',
39
+ '@INPUT@',
40
+ ],
41
+ build_by_default : true,
42
+ )
43
+
44
+ # --------------------------------------------------
45
+ # 2. Copy ABI module → pygtide/etpred.pyd
46
+ # --------------------------------------------------
47
+ copy_code = '''
48
+ import glob, os, shutil, sys
49
+
50
+ build_dir = os.getcwd()
51
+ src_root = r"@0@"
52
+
53
+ pattern = os.path.join(build_dir, '**', 'etpred*.@1@')
54
+ matches = glob.glob(pattern, recursive=True)
55
+
56
+ if not matches:
57
+ print("ERROR: etpred ABI module not found")
58
+ sys.exit(1)
59
+
60
+ dst = os.path.join(src_root, 'pygtide', 'etpred.@1@')
61
+ shutil.copy(matches[0], dst)
62
+ print(f"Copied {matches[0]} -> {dst}")
63
+ '''.format(
64
+ meson.project_source_root(),
65
+ ext
66
+ )
67
+
68
+ custom_target(
69
+ 'copy_etpred',
70
+ input : etpred_build,
71
+ output : 'etpred.copy.stamp',
72
+ command : [py, '-c', copy_code],
73
+ build_by_default : true,
74
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygtide
3
- Version: 0.8.0
3
+ Version: 0.8.1
4
4
  Summary: A Python module and wrapper for ETERNA PREDICT to compute gravitational tides on Earth
5
5
  Author: Tom Eulenfeld
6
6
  Author-email: "Gabriel C. Rau" <gabriel@hydrogeo.science>
@@ -1,11 +1,12 @@
1
1
  LICENSE
2
2
  MANIFEST.in
3
3
  README.md
4
+ build_pygtide_abi.py
5
+ meson.build
4
6
  pyproject.toml
5
7
  setup.py
6
8
  pygtide/__init__.py
7
9
  pygtide/core.py
8
- pygtide/etpred.so
9
10
  pygtide/tests.py
10
11
  pygtide/update_etpred_data.py
11
12
  pygtide.egg-info/PKG-INFO
@@ -26,4 +27,5 @@ pygtide/commdat/hw95s.dat
26
27
  pygtide/commdat/ksm03.dat
27
28
  pygtide/commdat/ratgp95.dat
28
29
  pygtide/commdat/tamurahw.dat
29
- pygtide/commdat/xi1989hw.dat
30
+ pygtide/commdat/xi1989hw.dat
31
+ src/etpred.f90
@@ -12,7 +12,7 @@ build-backend = "setuptools.build_meta"
12
12
 
13
13
  [project]
14
14
  name = "pygtide"
15
- version = "0.8.0"
15
+ version = "0.8.1"
16
16
  description = "A Python module and wrapper for ETERNA PREDICT to compute gravitational tides on Earth"
17
17
  readme = "README.md"
18
18
  license = "MPL-2.0"
@@ -50,8 +50,7 @@ Issues = "https://github.com/hydrogeoscience/pygtide/issues"
50
50
  # Setuptools-specific configuration
51
51
  # ----------------------------
52
52
  [tool.setuptools]
53
- packages = ["pygtide"] # <-- move packages here
54
- include-package-data = true # include package data
53
+ packages = ["pygtide"]
55
54
 
56
55
  [tool.setuptools.package-data]
57
56
  pygtide = ["etpred.*", "commdat/*"]
pygtide-0.8.1/setup.py ADDED
@@ -0,0 +1,40 @@
1
+ # setup.py
2
+ from pathlib import Path
3
+ import sys
4
+
5
+ from setuptools import setup, Extension
6
+ from setuptools.command.build import build as _build
7
+
8
+
9
+ class build(_build):
10
+ def run(self):
11
+ # Detect platform-specific ABI extension
12
+ HERE = Path(__file__).resolve().parent
13
+
14
+ ext = '.pyd' if sys.platform.startswith('win') else '.so'
15
+ etpred_path = HERE / 'pygtide' / f'etpred{ext}'
16
+
17
+ if etpred_path.exists():
18
+ print(f"Use ABI module {etpred_path}")
19
+ else:
20
+ print(f"Prebuilt ABI module not found: {etpred_path}\n"
21
+ "Run build_pygtide_abi.py")
22
+ sys.path.insert(0, str(HERE))
23
+ import build_pygtide_abi
24
+ build_pygtide_abi.build()
25
+ if not etpred_path.exists():
26
+ raise FileNotFoundError(f"No ABI module, error in Meson build")
27
+
28
+
29
+ # Define the prebuilt extension
30
+ etpred_module = Extension(
31
+ name='pygtide.etpred',
32
+ sources=[], # No sources; using prebuilt ABI
33
+ extra_objects=[str(etpred_path)],
34
+ )
35
+
36
+ super().run()
37
+
38
+
39
+ # Metadata pulled from pyproject.toml
40
+ setup(cmdclass={'build': build})