Extract ifcopenshell directory from git repo into destination.
(dst: Path)
| 48 | class WheelBuilder: |
| 49 | @staticmethod |
| 50 | def extract_ifcopenshell_from_git(dst: Path) -> None: |
| 51 | """Extract ifcopenshell directory from git repo into destination.""" |
| 52 | Tools.rmrf(dst) |
| 53 | |
| 54 | print(f"Extracting ifcopenshell from git to {dst}...") |
| 55 | # Use git ls-files piped to git checkout-index to avoid copying |
| 56 | # untracked or ignored files from the actual repo. |
| 57 | ls_proc = subprocess.Popen( |
| 58 | ["git", "ls-files", "-z", "src/ifcopenshell-python/ifcopenshell"], |
| 59 | cwd=REPO_ROOT, |
| 60 | stdout=subprocess.PIPE, |
| 61 | stderr=subprocess.PIPE, |
| 62 | ) |
| 63 | checkout_proc = subprocess.Popen( |
| 64 | ["git", "checkout-index", "-z", "--prefix", "pyodide/", "--stdin"], |
| 65 | cwd=REPO_ROOT, |
| 66 | stdin=ls_proc.stdout, |
| 67 | stdout=subprocess.PIPE, |
| 68 | stderr=subprocess.PIPE, |
| 69 | ) |
| 70 | assert ls_proc.stdout is not None |
| 71 | ls_proc.stdout.close() |
| 72 | checkout_proc.communicate() |
| 73 | |
| 74 | if checkout_proc.returncode != 0: |
| 75 | assert checkout_proc.stderr is not None |
| 76 | raise RuntimeError(f"Failed to extract: {checkout_proc.stderr.decode()}") |
| 77 | |
| 78 | # Move src/ifcopenshell-python/ifcopenshell to ifcopenshell. |
| 79 | temp_src = PYODIDE_DIR / "src" / "ifcopenshell-python" / "ifcopenshell" |
| 80 | shutil.move(temp_src, dst) |
| 81 | |
| 82 | # Clean up temporary src directory. |
| 83 | Tools.rmrf(PYODIDE_DIR / "src") |
| 84 | |
| 85 | print("✓ Extracted ifcopenshell from git") |
| 86 | |
| 87 | @staticmethod |
| 88 | def get_wheel_url(makefile_path: Path) -> str: |