plone / plonecli

Plone Command Line Client - for creating and working with custom add-ons and themes
https://pypi.org/project/plonecli/
Other
19 stars 10 forks source link

Fix default author name and email #42

Open mzfr opened 5 years ago

mzfr commented 5 years ago

I was testing plonecli by creating an addon.

I started with plonecli create addon src/collective.todo

➜ plonecli create addon src/collective.todo

RUN: mrbob bobtemplates.plone:addon -O src/collective.todo

Welcome to mr.bob interactive mode. Before we generate a directory structure, some questions need to be answered.

Answer with a question mark to display help.
Values in square brackets at the end of the questions show the default value if there is no answer.

--> Author's name [b'mzfr']: 

--> Author's email [b'mehtab.zafar98@gmail.com']: 

--> Author's GitHub username: mzfr

--> Package description [An add-on for Plone]: Testing addon

--> Do you want me to initialze a GIT repository in your new package? (y/n) [y]: n

--> Plone version [5.1]: 5.1

git init is disabled!
Generated file structure at /home/mzfr/dev/plonecli/src/collective.todo

Here When I was prompted for Author's name instead of entering anything I simply pressed enter and same for Author's email.

Now when I tried to build by doing plonecli build I got an error:

➜ plonecli build      

RUN: virtualenv .
Using base prefix '/usr'
New python executable in /home/mzfr/dev/plonecli/src/collective.todo/bin/python
Installing setuptools, pip, wheel...
done.

RUN: ./bin/pip install -r requirements.txt --upgrade
Collecting setuptools==38.2.4 (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/bb/e0/ea620f9ecbaaaf3ebb288cdbbe8cc20b6a789c17e42d8916662b218e3349/setuptools-38.2.4-py2.py3-none-any.whl (489kB)
    100% |████████████████████████████████| 491kB 3.0MB/s 
Collecting zc.buildout==2.11.4 (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/5b/87/e6f32bb65bc039aabbf7bc70e10826559e24664fdd395653ffb867e983d1/zc.buildout-2.11.4-py2.py3-none-any.whl (157kB)
    100% |████████████████████████████████| 163kB 4.6MB/s 
Installing collected packages: setuptools, zc.buildout
  Found existing installation: setuptools 40.6.3
    Uninstalling setuptools-40.6.3:
      Successfully uninstalled setuptools-40.6.3
Successfully installed setuptools-38.2.4 zc.buildout-2.11.4

RUN: ./bin/buildout
Creating directory '/home/mzfr/dev/plonecli/src/collective.todo/eggs'.
Getting distribution for 'mr.developer>=1.38'.
Got mr.developer 1.38.
Creating directory '/home/mzfr/dev/plonecli/src/collective.todo/parts'.
Creating directory '/home/mzfr/dev/plonecli/src/collective.todo/develop-eggs'.
Develop: '/home/mzfr/dev/plonecli/src/collective.todo/.'
Traceback (most recent call last):
  File "/tmp/tmpwittrhfd", line 14, in <module>
    exec(compile(f.read(), '/home/mzfr/dev/plonecli/src/collective.todo/./setup.py', 'exec'))
  File "/home/mzfr/dev/plonecli/src/collective.todo/./setup.py", line 32
    author='b'mzfr'',
                 ^
SyntaxError: invalid syntax
While:
  Installing.
  Processing develop directory '/home/mzfr/dev/plonecli/src/collective.todo/.'.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/home/mzfr/dev/plonecli/src/collective.todo/lib/python3.5/site-packages/zc/buildout/buildout.py", line 2127, in main
    getattr(buildout, command)(args)
  File "/home/mzfr/dev/plonecli/src/collective.todo/lib/python3.5/site-packages/zc/buildout/buildout.py", line 659, in install
    installed_develop_eggs = self._develop()
  File "/home/mzfr/dev/plonecli/src/collective.todo/lib/python3.5/site-packages/zc/buildout/buildout.py", line 902, in _develop
    zc.buildout.easy_install.develop(setup, dest)
  File "/home/mzfr/dev/plonecli/src/collective.todo/lib/python3.5/site-packages/zc/buildout/easy_install.py", line 1067, in develop
    call_subprocess(args)
  File "/home/mzfr/dev/plonecli/src/collective.todo/lib/python3.5/site-packages/zc/buildout/easy_install.py", line 165, in call_subprocess
    % repr(args)[1:-1])
Exception: Failed to run command:
'/home/mzfr/dev/plonecli/src/collective.todo/bin/python', '/tmp/tmpwittrhfd', '-q', 'develop', '-mN', '-d', '/home/mzfr/dev/plonecli/src/collective.todo/develop-eggs/tmp68f0ovilbuild'

In the first traceback we can see that author='b'mzfr'', is causing a problem because b'mzfr' is actually treated as a string so an extra '' are added around that. This same problem is happening with the email.

This was fixed when I removed those extra quotes('') from the name and email i.e

author='b'mzfr'' changes to `author=b'mzfr' and
author='b'mehtab.zafar98@gmail.com'' changes to author=b'mehtab.zafar98@gmail.com'
kakshay21 commented 5 years ago

@MrTango this is due to codecs library which is adding b'' in Python3. https://docs.python.org/3/library/codecs.html#codecs.open And not in Python2.

mzfr commented 5 years ago

@kakshay21 Can I work on this issue?

kakshay21 commented 5 years ago

Sure but see that you don't break anything in py2.7