pycodata 2.2.0__tar.gz → 2.3.0__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 (32) hide show
  1. pycodata-2.3.0/Makefile +114 -0
  2. {pycodata-2.2.0/src/pycodata.egg-info → pycodata-2.3.0}/PKG-INFO +2 -2
  3. pycodata-2.3.0/VERSION +1 -0
  4. pycodata-2.3.0/_README.md +21 -0
  5. {pycodata-2.2.0 → pycodata-2.3.0}/pyproject.toml +1 -1
  6. pycodata-2.3.0/setup-old.txt +143 -0
  7. pycodata-2.3.0/src/pycodata/codata.h +1405 -0
  8. {pycodata-2.2.0 → pycodata-2.3.0}/src/pycodata/libcodata.a +0 -0
  9. {pycodata-2.2.0 → pycodata-2.3.0}/src/pycodata/libcodata.dll.a +0 -0
  10. {pycodata-2.2.0 → pycodata-2.3.0}/src/pycodata/libcodata.dylib +0 -0
  11. pycodata-2.3.0/src/pycodata/libcodata.so +0 -0
  12. {pycodata-2.2.0 → pycodata-2.3.0/src/pycodata.egg-info}/PKG-INFO +2 -2
  13. {pycodata-2.2.0 → pycodata-2.3.0}/src/pycodata.egg-info/SOURCES.txt +7 -0
  14. pycodata-2.3.0/test/__init__.py +5 -0
  15. pycodata-2.2.0/VERSION +0 -1
  16. pycodata-2.2.0/src/pycodata/libcodata.dll +0 -0
  17. pycodata-2.2.0/src/pycodata/libcodata.so +0 -0
  18. {pycodata-2.2.0 → pycodata-2.3.0}/LICENSE +0 -0
  19. {pycodata-2.2.0 → pycodata-2.3.0}/MANIFEST.in +0 -0
  20. {pycodata-2.2.0 → pycodata-2.3.0}/README.md +0 -0
  21. {pycodata-2.2.0/src/pycodata → pycodata-2.3.0}/codata.h +0 -0
  22. {pycodata-2.2.0 → pycodata-2.3.0}/setup.cfg +0 -0
  23. {pycodata-2.2.0 → pycodata-2.3.0}/setup.py +0 -0
  24. {pycodata-2.2.0 → pycodata-2.3.0}/src/pycodata/__init__.py +0 -0
  25. {pycodata-2.2.0 → pycodata-2.3.0}/src/pycodata/_codata_constants_2010.c +0 -0
  26. {pycodata-2.2.0 → pycodata-2.3.0}/src/pycodata/_codata_constants_2014.c +0 -0
  27. {pycodata-2.2.0 → pycodata-2.3.0}/src/pycodata/_codata_constants_2018.c +0 -0
  28. {pycodata-2.2.0 → pycodata-2.3.0}/src/pycodata/_codata_constants_2022.c +0 -0
  29. {pycodata-2.2.0 → pycodata-2.3.0}/src/pycodata/_codata_version.c +0 -0
  30. {pycodata-2.2.0 → pycodata-2.3.0}/src/pycodata.egg-info/dependency_links.txt +0 -0
  31. {pycodata-2.2.0 → pycodata-2.3.0}/src/pycodata.egg-info/top_level.txt +0 -0
  32. {pycodata-2.2.0 → pycodata-2.3.0}/test/test_all.py +0 -0
@@ -0,0 +1,114 @@
1
+ # ---------------------------------------------------------------------
2
+ # CONFIGURATION
3
+ GENPY=../scripts/gen_cpython.py
4
+
5
+ AST_SRC=$(wildcard ../data/*.toml)
6
+ PYTHON_SRC=$(patsubst ../data/%.toml, ./src/pycodata/_%.c, $(AST_SRC))
7
+
8
+ SETUP=setup.py pyproject.toml
9
+ # ---------------------------------------------------------------------
10
+
11
+
12
+ # ---------------------------------------------------------------------
13
+ # TARGETS
14
+ .PHONY: sources package clean
15
+
16
+ all: package
17
+ # ---------------------------------------------------------------------
18
+
19
+
20
+ # ---------------------------------------------------------------------
21
+ # SOURCES
22
+ sources: $(PYTHON_SRC)
23
+
24
+ src/pycodata/_%.c: ../data/%.toml
25
+ $(FPM_PYGEN) $(GENPY) $< $@
26
+ # ---------------------------------------------------------------------
27
+
28
+
29
+ # ---------------------------------------------------------------------
30
+ # COMPILATION
31
+ package: python3.10 python3.11 python3.12 python3.13 python3.14t python3.14
32
+
33
+ python3.14: $(SETUP)
34
+ @echo "########### PYTHON 3.14 ##########"
35
+ $(FPM_PY)3.14 setup.py build_ext --inplace
36
+ $(FPM_PY)3.14 -m build --no-isolation --sdist
37
+ $(FPM_PY)3.14 -m build --no-isolation --wheel
38
+ $(FPM_AW)
39
+ @echo "#################################"
40
+
41
+ python3.14t: $(SETUP)
42
+ @echo "########### PYTHON 3.14 ##########"
43
+ $(FPM_PY)3.14t setup.py build_ext --inplace
44
+ $(FPM_PY)3.14t -m build --no-isolation --wheel
45
+ @echo "#################################"
46
+
47
+ python3.13: $(SETUP)
48
+ @echo "########### PYTHON 3.13 ##########"
49
+ $(FPM_PY)3.13 setup.py build_ext --inplace
50
+ $(FPM_PY)3.13 -m build --no-isolation --wheel
51
+ @echo "#################################"
52
+
53
+ python3.12: $(SETUP)
54
+ @echo "########### PYTHON 3.12 ##########"
55
+ $(FPM_PY)3.12 setup.py build_ext --inplace
56
+ $(FPM_PY)3.12 -m build --no-isolation --wheel
57
+ @echo "#################################"
58
+
59
+ python3.11: $(SETUP)
60
+ @echo "########### PYTHON 3.11 ##########"
61
+ $(FPM_PY)3.11 setup.py build_ext --inplace
62
+ $(FPM_PY)3.11 -m build --no-isolation --wheel
63
+ @echo "#################################"
64
+
65
+ python3.10: $(SETUP)
66
+ @echo "########### PYTHON 3.10 ##########"
67
+ $(FPM_PY)3.10 setup.py build_ext --inplace
68
+ $(FPM_PY)3.10 -m build --no-isolation --wheel
69
+ @echo "#################################"
70
+
71
+ test: test3.10 test3.11 test3.12 test3.13 test3.14
72
+
73
+ test3.14: python3.14
74
+ $(FPM_PY)3.14 -m pytest -v
75
+
76
+ test3.14t: python3.14t
77
+ $(FPM_PY)3.14t -m pytest -v
78
+
79
+ test3.13: python3.13
80
+ $(FPM_PY)3.13 -m pytest -v
81
+
82
+ test3.12: python3.12
83
+ $(FPM_PY)3.12 -m pytest -v
84
+
85
+ test3.11: python3.11
86
+ $(FPM_PY)3.11 -m pytest -v
87
+
88
+ test3.10: python3.10
89
+ $(FPM_PY)3.10 -m pytest -v
90
+
91
+ example: python3.14
92
+ $(FPM_PY)3.14 ../example/example.py
93
+
94
+ # ---------------------------------------------------------------------
95
+
96
+
97
+ # ---------------------------------------------------------------------
98
+ # OTHERS
99
+ clean:
100
+ rm -rf build
101
+ rm -rf dist
102
+ rm -rf *.egg-info
103
+ rm -rf __pycache__
104
+ rm -rf wheelhouse
105
+ rm -rf $(FPM_PY_SRC)/__pycache__
106
+ rm -f $(FPM_PY_SRC)/$(FPM_NAME)*.h
107
+ rm -f $(FPM_PY_SRC)/_$(FPM_NAME)_constants*.c
108
+ rm -f $(FPM_PY_SRC)/*.a
109
+ rm -f $(FPM_PY_SRC)/*.so
110
+ rm -f $(FPM_PY_SRC)/*.dylib
111
+ rm -f $(FPM_PY_SRC)/*.dll
112
+ rm -f $(FPM_PY_SRC)/*.dll.a
113
+ rm -f $(FPM_PY_SRC)/*.pyd
114
+ # ---------------------------------------------------------------------
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycodata
3
- Version: 2.2.0
3
+ Version: 2.3.0
4
4
  Summary: pycodata: CODATA constants for python.
5
- Author-email: Milan Skocic <milan.skocic@icloud.com>
5
+ Author-email: Milan Skocic <milan.skocic@gmail.com>
6
6
  License-Expression: MIT
7
7
  Project-URL: Documentation, https://milanskocic.github.io/codata/index.html
8
8
  Project-URL: Source, https://github.com/MilanSkocic/codata
pycodata-2.3.0/VERSION ADDED
@@ -0,0 +1 @@
1
+ 2.3.0
@@ -0,0 +1,21 @@
1
+
2
+ # Introduction
3
+
4
+ Python wrapper around the
5
+ [Fortran codata library](https://milanskocic.github.io/codata/ ).
6
+ The Fortran library does not need to be installed, the python wrapper embeds all needed fortran dependencies
7
+ for Windows and MacOS.
8
+ On linux, you might have to install `libgfortran` if it is not distributed by default with your linux distribution.
9
+
10
+ # Installation
11
+
12
+ In a terminal, enter:
13
+
14
+ ```python
15
+ pip install pycodata
16
+ ```
17
+
18
+ # License
19
+
20
+ MIT
21
+
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "pycodata"
7
7
  dynamic = ["version"]
8
- authors = [{name = "Milan Skocic", email = "milan.skocic@icloud.com"}]
8
+ authors = [{name = "Milan Skocic", email = "milan.skocic@gmail.com"}]
9
9
  description = "pycodata: CODATA constants for python."
10
10
  readme = "README.md"
11
11
  requires-python = ">=3.9"
@@ -0,0 +1,143 @@
1
+ r"""Setup."""
2
+ import platform
3
+ import shutil
4
+ import pathlib
5
+ import subprocess
6
+ from setuptools import setup, Extension
7
+
8
+ LIBSDARWIN = ("libgfortran.5", "libquadmath.0", "libgcc_s.1.1")
9
+ LIBSWINDOWS = ("libgfortran-5", "libquadmath-0", "libgcc_s_seh-1", "libwinpthread-1")
10
+ LIBSLINUX = []
11
+ ROOTLINUX = "/usr/lib/"
12
+ ROOTDARWIN = "/usr/local/opt/gcc/lib/gcc/current"
13
+ ROOTWINDOWS = "C:/msys64/mingw64/bin"
14
+ ROOT = ROOTLINUX
15
+ LIBS = LIBSLINUX
16
+
17
+ name = "codata"
18
+ libraries = None
19
+ library_dirs = None
20
+ runtime_library_dirs = None
21
+ extra_objects = None
22
+ ext = [".so"]
23
+
24
+
25
+ if platform.system() == "Linux":
26
+ libraries = [name]
27
+ library_dirs = [f"./src/py{name:s}"]
28
+ runtime_library_dirs = ["$ORIGIN"]
29
+ ext = [".so"]
30
+ ROOT = ROOTLINUX
31
+ LIBS = LIBSLINUX
32
+ if platform.system() == "Windows":
33
+ extra_objects = [f"./src/py{name:s}/lib{name:s}.dll.a"]
34
+ ext = [".dll", ".dll.a"]
35
+ ROOT = ROOTWINDOWS
36
+ LIBS = LIBSWINDOWS
37
+ if platform.system() == "Darwin":
38
+ libraries = [name]
39
+ library_dirs = [f"./src/py{name:s}"]
40
+ runtime_library_dirs = ["@loader_path"]
41
+ ext = [".dylib"]
42
+ ROOT = ROOTDARWIN
43
+ LIBS = LIBSDARWIN
44
+
45
+
46
+ # Headers
47
+ root_src = pathlib.Path(f"./src/py{name:s}/include/")
48
+ root_dest = pathlib.Path(f"./src/py{name:s}/")
49
+ files = [f"{name:s}.h"]
50
+ for file in files:
51
+ src = root_src / file
52
+ dest = root_dest / file
53
+ if not src.exists():
54
+ raise ValueError(f"The library {name:s} was not installed. Run in the root folder: make install prefix=./py/src/py{name:s}")
55
+ try:
56
+ print(f"copying {str(src):s} -> {str(dest.parent):s}.")
57
+ shutil.copy(src, dest)
58
+ except:
59
+ print(f"{file:s} was not copied.")
60
+
61
+ # Libs
62
+ root_src = pathlib.Path(f"./src/py{name:s}/lib/")
63
+ root_dest = pathlib.Path(f"./src/py{name:s}/")
64
+ files = list(map(lambda s: f"lib{name:s}"+s, ext))
65
+ for file in files:
66
+ src = root_src / file
67
+ dest = root_dest / file
68
+ if not src.exists():
69
+ raise ValueError(f"The library {name:s} was not installed. Run in the root folder: make install prefix=./py/src/py{name:s}")
70
+ try:
71
+ print(f"copying {str(src):s} -> {str(dest.parent):s}.")
72
+ shutil.copy(src, dest)
73
+ except:
74
+ print(f"{file:s} was not copied.")
75
+
76
+ # gfortran libs
77
+ root_src = pathlib.Path(ROOT)
78
+ root_dest = pathlib.Path(f"./src/py{name:s}/")
79
+ files = LIBS
80
+ for file in files:
81
+ src = root_src / (file + ext[0])
82
+ dest = root_dest / (file + ext[0])
83
+ cmd = ["install_name_tool", "-change", f"{str(src):s}", f"@loader_path/{src.name}", f"./src/py{name:s}/lib{name:s}{ext[0]:s}"]
84
+ try:
85
+ print(f"copying {str(src):s} -> {str(dest.parent):s}.")
86
+ shutil.copy(src, dest)
87
+ if platform.system() == "Darwin":
88
+ print(f"changing rpath for {str(file):s}")
89
+ subprocess.check_call(cmd)
90
+ except subprocess.CalledProcessError:
91
+ print(" ".join(cmd) + " was not successful.")
92
+ except:
93
+ print(f"{file:s} was not copied.")
94
+
95
+ # check rpaths for Darwin
96
+ if platform.system() == "Darwin":
97
+ cmd = ["otool", "-L", f"./src/py{name:s}/lib{name:s}{ext[0]:s}"]
98
+ try:
99
+ print(f"checking rpaths")
100
+ subprocess.check_call(cmd)
101
+ except subprocess.CalledProcessError:
102
+ print(" ".join(cmd) + " was not successful.")
103
+
104
+ version = None
105
+ with open("./VERSION", "r") as f:
106
+ version = f.read().strip()
107
+
108
+ if __name__ == "__main__":
109
+
110
+ mod_constants_2022 = Extension(name="pycodata.constants_2022",
111
+ sources=["./src/pycodata/cpy_codata_constants_2022.c"],
112
+ libraries=libraries,
113
+ library_dirs=library_dirs,
114
+ runtime_library_dirs=runtime_library_dirs,
115
+ extra_objects=extra_objects)
116
+ mod_constants_2018 = Extension(name="pycodata.constants_2018",
117
+ sources=["./src/pycodata/cpy_codata_constants_2018.c"],
118
+ libraries=libraries,
119
+ library_dirs=library_dirs,
120
+ runtime_library_dirs=runtime_library_dirs,
121
+ extra_objects=extra_objects)
122
+ mod_constants_2014 = Extension(name="pycodata.constants_2014",
123
+ sources=["./src/pycodata/cpy_codata_constants_2014.c"],
124
+ libraries=libraries,
125
+ library_dirs=library_dirs,
126
+ runtime_library_dirs=runtime_library_dirs,
127
+ extra_objects=extra_objects)
128
+ mod_constants_2010 = Extension(name="pycodata.constants_2010",
129
+ sources=["./src/pycodata/cpy_codata_constants_2010.c"],
130
+ libraries=libraries,
131
+ library_dirs=library_dirs,
132
+ runtime_library_dirs=runtime_library_dirs,
133
+ extra_objects=extra_objects)
134
+ mod_version = Extension(name="pycodata.version",
135
+ sources=["./src/pycodata/cpy_codata_version.c"],
136
+ libraries=libraries,
137
+ library_dirs=library_dirs,
138
+ runtime_library_dirs=runtime_library_dirs,
139
+ extra_objects=extra_objects)
140
+ setup(version=version,
141
+ ext_modules=[mod_constants_2022, mod_constants_2018, mod_constants_2014, mod_constants_2010, mod_version]
142
+ )
143
+