cpp-pd-code-simplify-interface 0.1.4__tar.gz → 0.1.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cpp-pd-code-simplify-interface
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Python interface for cpp-pd-code-simplify with runtime C++ compilation.
5
5
  License-Expression: MIT
6
6
  Author: GGN_2015
@@ -34,6 +34,11 @@ use, the package compiles a cached local dynamic library through
34
34
  `cpp-simple-interface`; later calls reuse that library through `ctypes`. A C++14
35
35
  compiler compatible with `g++` must be available at runtime.
36
36
 
37
+ The core C++ source and header are not stored as permanent generated copies in
38
+ this subproject. The custom Poetry build backend syncs them from the repository
39
+ root during `poetry build`, embeds them in the wheel and sdist, then removes the
40
+ temporary copies from the working tree.
41
+
37
42
  Calls use the C++ library's default preprocessing pipeline: R1-move removal
38
43
  followed by nugatory-crossing removal, then iterative mid-simplification.
39
44
 
@@ -14,6 +14,11 @@ use, the package compiles a cached local dynamic library through
14
14
  `cpp-simple-interface`; later calls reuse that library through `ctypes`. A C++14
15
15
  compiler compatible with `g++` must be available at runtime.
16
16
 
17
+ The core C++ source and header are not stored as permanent generated copies in
18
+ this subproject. The custom Poetry build backend syncs them from the repository
19
+ root during `poetry build`, embeds them in the wheel and sdist, then removes the
20
+ temporary copies from the working tree.
21
+
17
22
  Calls use the C++ library's default preprocessing pipeline: R1-move removal
18
23
  followed by nugatory-crossing removal, then iterative mid-simplification.
19
24
 
@@ -15,17 +15,12 @@ from poetry.core.masonry import api as poetry_api
15
15
  PROJECT_ROOT = Path(__file__).resolve().parents[1]
16
16
  REPO_ROOT = PROJECT_ROOT.parents[1]
17
17
 
18
- SOURCE_FILES = [
18
+ EMBEDDED_SOURCE_FILES = [
19
19
  (
20
20
  REPO_ROOT / "src" / "pdcode_simplify.cpp",
21
21
  PROJECT_ROOT / "cpp_pd_code_simplify_interface" / "data" / "src" / "pdcode_simplify.cpp",
22
22
  "cpp_pd_code_simplify_interface/data/src/pdcode_simplify.cpp",
23
23
  ),
24
- (
25
- PROJECT_ROOT / "cpp_pd_code_simplify_interface" / "data" / "src" / "native_interface.cpp",
26
- PROJECT_ROOT / "cpp_pd_code_simplify_interface" / "data" / "src" / "native_interface.cpp",
27
- "cpp_pd_code_simplify_interface/data/src/native_interface.cpp",
28
- ),
29
24
  (
30
25
  REPO_ROOT / "include" / "pdcode_simplify" / "pdcode_simplify.hpp",
31
26
  PROJECT_ROOT
@@ -38,23 +33,39 @@ SOURCE_FILES = [
38
33
  ),
39
34
  ]
40
35
 
36
+ STATIC_SOURCE_FILES = [
37
+ (
38
+ PROJECT_ROOT / "cpp_pd_code_simplify_interface" / "data" / "src" / "native_interface.cpp",
39
+ PROJECT_ROOT / "cpp_pd_code_simplify_interface" / "data" / "src" / "native_interface.cpp",
40
+ "cpp_pd_code_simplify_interface/data/src/native_interface.cpp",
41
+ ),
42
+ ]
43
+
44
+ SOURCE_FILES = EMBEDDED_SOURCE_FILES + STATIC_SOURCE_FILES
45
+
41
46
 
42
47
  def _sync_cpp_sources() -> None:
43
48
  missing = []
44
- for source, target, _ in SOURCE_FILES:
49
+ for source, target, _ in EMBEDDED_SOURCE_FILES:
45
50
  if source.exists():
46
- if source.resolve() != target.resolve():
51
+ if (
52
+ source.resolve() != target.resolve()
53
+ and (not target.exists() or source.read_bytes() != target.read_bytes())
54
+ ):
47
55
  target.parent.mkdir(parents=True, exist_ok=True)
48
56
  shutil.copyfile(source, target)
49
57
  elif not target.exists():
50
58
  missing.append((source, target))
59
+ for source, target, _ in STATIC_SOURCE_FILES:
60
+ if not source.exists() and not target.exists():
61
+ missing.append((source, target))
51
62
  if missing:
52
63
  details = ", ".join(f"{source} or {target}" for source, target in missing)
53
64
  raise FileNotFoundError(f"cpp-pd-code-simplify source files were not found: {details}")
54
65
 
55
66
 
56
67
  def _clean_cpp_sources() -> None:
57
- for source, target, _ in SOURCE_FILES:
68
+ for source, target, _ in EMBEDDED_SOURCE_FILES:
58
69
  if source.exists() and target.exists() and source.resolve() != target.resolve():
59
70
  target.unlink()
60
71
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "cpp-pd-code-simplify-interface"
3
- version = "0.1.4"
3
+ version = "0.1.5"
4
4
  description = "Python interface for cpp-pd-code-simplify with runtime C++ compilation."
5
5
  authors = [
6
6
  {name = "GGN_2015", email = "neko@jlulug.org"}
@@ -24,9 +24,7 @@ cpp-pd-code-simplify-interface = "cpp_pd_code_simplify_interface.main:main"
24
24
  packages = [{ include = "cpp_pd_code_simplify_interface" }]
25
25
  include = [
26
26
  { path = "build_backend/cpp_pd_code_simplify_interface_build_backend.py", format = ["sdist"] },
27
- { path = "cpp_pd_code_simplify_interface/data/src/native_interface.cpp", format = ["sdist", "wheel"] },
28
- { path = "cpp_pd_code_simplify_interface/data/src/pdcode_simplify.cpp", format = ["sdist", "wheel"] },
29
- { path = "cpp_pd_code_simplify_interface/data/include/pdcode_simplify/pdcode_simplify.hpp", format = ["sdist", "wheel"] }
27
+ { path = "cpp_pd_code_simplify_interface/data/src/native_interface.cpp", format = ["sdist", "wheel"] }
30
28
  ]
31
29
 
32
30
  [build-system]