macports / upt-macports

The Universal Packaging Tool (upt) backend for MacPorts
https://framagit.org/upt/upt
BSD 3-Clause "New" or "Revised" License
8 stars 12 forks source link

Change python naming convention #33

Closed Korusuke closed 5 years ago

Korusuke commented 5 years ago

python.rootname is set if there's capitalization but this check is performed on the name supplied by the user and not on the actual name.

For example for WTForms and wtforms file is generated but one with the rootname field and one without which should not be usually there. For solving this upt-pypi should give the actual package name instead of the name supplied by the user.

reneeotten commented 5 years ago

ah, I see - so the package name depends on whether the user provides the port with/without capitalization; the rest of the Portfile is the same because the capitalization apparently doesn't matter for the PyPI url.

That is indeed a problem, but should be easy to solve as the actual PyPI name is present as self.json['info']['name'] it just not returned in the parse function of upt-pypi. @Steap what do you think?

Steap commented 5 years ago

OK, I'll include that in the next upt-pypi version.

reneeotten commented 5 years ago

sounds good @Steap! I would really like to get the templates including this naming business finalized as soon as possible, so depending on how long that's going to take, it would be easy to add a workaround in the backend for this right now. You can get the exact PyPI name by using

pypi_name = self.upt_pkg.get_archive().filename.split('-'+self.upt_pkg.version)[0])
reneeotten commented 5 years ago

@Korusuke @Steap so what's your opinion on this?

Korusuke commented 5 years ago

I guess even if name source is changed in upt-pypi, for backends it will be the same variable so we can merge this PR without waiting for that currently.

reneeotten commented 5 years ago

I guess even if name source is changed in upt-pypi, for backends it will be the same variable so we can merge this PR without waiting for that currently.

Right, but in the PR right now the behavior depends on what the end-user gives as a package name (e.g., Spinxh versus sphinx) and can result in a non-working Portfile - that should not be the case. So, we can either what for the functionality to be added to upt-pypi or, as I would prefer, you make the change I suggested, we merge this PR and once upt-pypi has gained the "real_name" functionality we change to that.

reneeotten commented 5 years ago

thanks @Korusuke this works fine now so I am going to merge it! Once upt-pypi returns the "real" PyPI package name we can use that instead of extracting it from the archive filename.