Closed nbraud closed 1 month ago
Oops I forgot to fix (Done, obviously~)pypi.Uploader.upload
PS: How did mypy
not scream about calling a non-existent function? :scream_cat:
@duckinator There's something really fucky going on, I keep hitting mistakes which mypy
should have caught but didn't
Squashed down all the fixups now that the tests pass
I just realised, filesystem-independence isn't really meaningful for builder
, since that could only arise from a bug in build.ProjectBuilder
, so I guess I'll leave the testing to that for this PR, and start on remolishing the rest of the API :smiling_imp:
[x] Restructure
builder
's API, reducing it toprepare(src: Path, dst: Path) -> Builder
context manager which sets up an isolated environment and installs the build system's dependenciesBuilder
abstract class exposingbuild
,metadata
, andzipapp
methodsBuilder
is made abstract, so instances can only be obtained within the managed context, ensuring the build environment was not cleaned up between calls. (Unless one uses RTTI to get the concrete class from aprepare
d object, or does not useprepare
as a context manager...)Add tests for
builder
ensuring there are no dependencies left onIsolatedEnv
itself, which is a fresh directory beneath/tmp
and source dir) in particular the contents of the destination directory should not matter[ ] Fix suboptimal use of the builder API, due to API limitations in the rest of bork
api.build
andapi.build_zipapp
do not reuse the sameBuilder
, causing isolated environment and wheel to be built twice ;api.release
does not have access to theBuilder
's returned artefactPath
s andPackageMetadata
, instead performing filesystem-augurypypi.Uploader.upload
isn't passed the metadata, and would have to rebuild it again... with no guarantee that the source wasn't modified betweenbork build
andbork release
:imp: That issue already existed, so I won't consider it a blocker for this PR.I think I can safely say this will be addressed in follow-up PRs, given that we'll likely end up rewriting Bork's entire API surface, both internal and public.
PS: I just realised I could just squash all those commits together, given that I did a few minor refactors... then rewrote the entire hecking file >_>'