Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow or Warn '-' in addon names #72

Open
arky opened this issue Nov 24, 2021 · 5 comments
Open

Disallow or Warn '-' in addon names #72

arky opened this issue Nov 24, 2021 · 5 comments

Comments

@arky
Copy link

arky commented Nov 24, 2021

  • Plone CLI version: 2.1.2
  • Bobtemplates.plone: 5.2.1
  • Python version: Python 3.9.7
  • Operating System: Ubuntu 21.10

Description

Create an addon with '-' in the name. This makes the package incompatible with pip.

What I Did

$ plonecli create addon collective.new-testcase

$ cd collective.new-testcase

$ python -m virtualenv . 

$ source bin/activate

$ ./bin/pip install -r requirements.txt

$ ./bin/buildout -vvv
in: '/tmp/collective.new-testcase/.'
/tmp/collective.new-testcase/bin/python /tmp/tmpw94ch09q -q develop -mN -d /tmp/collective.new-testcase/develop-eggs/tmprorn71nwbuild
error in collective.new-testcase setup command: ("EntryPoint must be in 'name=module:attrs [extras]' format", 'update_locale = collective.new-testcase.locales.update:update_locale')
While:
  Installing.
  Processing develop directory '/tmp/collective.new-testcase/.'.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/tmp/collective.new-testcase/lib/python3.9/site-packages/zc/buildout/buildout.py", line 2174, in main
    getattr(buildout, command)(args)
  File "/tmp/collective.new-testcase/lib/python3.9/site-packages/zc/buildout/buildout.py", line 679, in install
    installed_develop_eggs = self._develop()
  File "/tmp/collective.new-testcase/lib/python3.9/site-packages/zc/buildout/buildout.py", line 922, in _develop
    zc.buildout.easy_install.develop(setup, dest)
  File "/tmp/collective.new-testcase/lib/python3.9/site-packages/zc/buildout/easy_install.py", line 1100, in develop
    call_subprocess(args)
  File "/tmp/collective.new-testcase/lib/python3.9/site-packages/zc/buildout/easy_install.py", line 164, in call_subprocess
    raise Exception(
Exception: Failed to run command:
'/tmp/collective.new-testcase/bin/python', '/tmp/tmpw94ch09q', '-q', 'develop', '-mN', '-d', '/tmp/collective.new-testcase/develop-eggs/tmprorn71nwbuild'


@MrTango
Copy link
Contributor

MrTango commented May 24, 2022

This is actually allowed syntax, but I'm aware that we still have problems with dashes or underlines in package names.
We have to test a bit more and find a more robust way to nromalize the package name.
Help is very welcome here ;)

@arky
Copy link
Author

arky commented May 25, 2022

@MrTango Meanwhile I think a good solution is to document this gotcha in the documentation to save people from pulling out their hair. :D

@MrTango
Copy link
Contributor

MrTango commented May 25, 2022

indeed, PR welcome ;)

@arky
Copy link
Author

arky commented May 27, 2022

@MrTango Attempted to fix it here https://github.com/plone/plonecli/pull/77/files

arky added a commit to arky/plonecli that referenced this issue May 27, 2022
@ale-rt
Copy link
Member

ale-rt commented May 30, 2022

Note that setuptools provides:

from setuptools.package_index import safe_name

I used that to fix a mr.developer issue with - in the package name:

You might want to use it to handle this issue as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants