Files
UmbraEdit/utils/build_pypi.py
B.D. Murphy 02c532234c
Some checks failed
Syntax / Linting and Type Checking (push) Has been cancelled
Tests / Linux Python 3.11 (push) Has been cancelled
Tests / Linux Python 3.12 (push) Has been cancelled
Tests / Linux Python 3.13 (push) Has been cancelled
Tests / Linux Python 3.14 (push) Has been cancelled
Tests / Linux Python 3.15 (push) Has been cancelled
Tests / MacOS Python 3.14 (push) Has been cancelled
Tests / Windows Python 3.14 (push) Has been cancelled
Tests / PR Coverage Report (push) Has been cancelled
Tests / Action Coverage Report (push) Has been cancelled
Tests / Ubuntu 24.04 & Sys Packages (push) Has been cancelled
Tests / Fedora 44 & Sys Packages (push) Has been cancelled
fix: add sys.path fix to build scripts for direct execution
2026-11-06 12:25:43 -08:00

73 lines
2.2 KiB
Python

"""
UmbraEdit - PyPI Build
========================
This file is a part of UmbraEdit.
Copyright (C) 2026 Veronica Berglyd Olsen and UmbraEdit contributors.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
""" # noqa
from __future__ import annotations
import argparse
import shutil
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from utils.common import ROOT_DIR, SETUP_DIR, copySourceCode, freshFolder, log, systemCall, updateMetaFile
def pypi(args: argparse.Namespace) -> None:
"""Build sdist and wheel packages for PyPI."""
log("")
log("[b]Build PyPI Packages[e]")
log("[b]===================[e]")
log("")
bldDir = ROOT_DIR / "dist_pypi"
outDir = bldDir / "umbraedit_src"
bldDir.mkdir(exist_ok=True)
freshFolder(outDir)
log("[b]Copying UmbraEdit source ...[e]")
log("")
copySourceCode(outDir)
updateMetaFile(outDir / "umbraedit" / "assets" / "meta.toml", buildFormat="pypi", installSource="pypi")
log("")
log("[b]Copying additional files ...[e]")
log("")
shutil.copyfile(ROOT_DIR / "pyproject.toml", outDir / "pyproject.toml")
log("[cg]Copied:[e] pyproject.toml")
shutil.copyfile(ROOT_DIR / "LICENSE.md", outDir / "LICENSE.md")
log("[cg]Copied:[e] LICENSE.md")
(outDir / "setup").mkdir(exist_ok=True)
shutil.copyfile(SETUP_DIR / "description_pypi.md", outDir / "setup" / "description_pypi.md")
log("[cg]Copied:[e] setup/description_pypi.md")
log("")
log("[b]Running uv build ...[e]")
log("")
systemCall(["uv", "build", "--out-dir", str(bldDir), str(outDir)])