frostming / pdm-packer

A PDM plugin that packs your packages into a zipapp
MIT License
48 stars 4 forks source link

when packing pdm the version given at the stdout is not the same as the one given when doing --version #27

Closed franzhaas closed 1 year ago

franzhaas commented 1 year ago

I can see the version of pdm used listed on stdout when creating the zipapp, but when running the zip app with --version, I get a different version.

To Reproduce git checkout 2.3.3 pdm add pdm-packer pdm pack ---------8<---------8<---------8<---------8<---------8<--------- ... [2022-12-15T20:38:56.771Z] v Install pdm 2.3.3+d20221215 successful [2022-12-15T20:38:56.771Z] [2022-12-15T20:38:56.771Z] All complete! [2022-12-15T20:38:56.771Z] [2022-12-15T20:38:56.771Z] Packages are prepared at xx [2022-12-15T20:38:56.771Z] Creating zipapp... [2022-12-15T20:38:57.026Z] Zipapp is generated at pdm.pyz [2022-12-15T20:38:57.586Z] pdm.pyz --version [2022-12-15T20:38:58.947Z] PDM, version 0.0.0+local ---------8<---------8<---------8<---------8<---------8<---------

I would have expected the version to be 2.3.3+d20221215, or 2.3.3 but not 0.0.0+local

Is this expected? What would I need to do to get the version to be 2.3.3+packedbymyorgnamehere?

Thanks in advance, Franz

frostming commented 1 year ago

Yes, when being packed in a zipapp, the version string can't be determined, because PDM doesn't write the version in a static file.

franzhaas commented 1 year ago

Ok, if pdm doesnt do it, as far as I can tell a horrible hack would be to write the version of choice into

src/pdm/verison.py

Any recommendation how to do this properly? Would it make more sense to do this as a pdm plugin? or integrate it into pdm-packer?

frostming commented 1 year ago

No, it was resolved upstream: https://github.com/pdm-project/pdm/commit/a6871d28f86c6558f2176fa0cb149c278ffb36f9