bobtemplates.plone icon indicating copy to clipboard operation
bobtemplates.plone copied to clipboard

theme_barceloneta: The filename, directory name, or volume label syntax is incorrect

Open me-kell opened this issue 2 years ago • 2 comments

  • Operating System: windows

Description

In Windows when generating a theme_barceloneta the path in the variable package.dottedname in the mrbob.configurator is not correctly splitted by "/" because Windows uses "\" as path separator. Subsequently package.namespace is wrong. Specially if the path contains dots.

The source of the problem is (https://github.com/plone/bobtemplates.plone/blob/b561328772efc5210196ba02c32de5493155654b/bobtemplates/plone/base.py#L434)

split("/") should be replaced with split(os.sep) for it to work in Windows.

I can confirm this solves the problem in Plone-5.2.8 and Plone-5.2.9.

AFAICS this issue should affect Plone-6x too!

What I Did

C:\Users\vagrant\Plone-5.2.9-zeo\py-3.8.10.final.0\Scripts\activate.bat

cd C:\Users\vagrant\Plone-5.2.9-zeo\zeocluster\src

rmdir /q/s C:\Users\vagrant\Plone-5.2.9-zeo\zeocluster\src\packagename.subpackagename

copy /Y con C:\Users\vagrant\Plone-5.2.9-zeo\zeocluster\src\addon.ini
[variables]
author.name = theAuthor
author.email = [email protected]
author.github.user = gitusername
package.description = An add-on for Plone
package.git.init = True
package.git.autocommit: True
plone.version = 5.2.8
python.version = python3.9
vscode_support = False
^Z

C:\Users\vagrant\Plone-5.2.9-zeo\zeocluster\bin\mrbob --config C:\Users\vagrant\Plone-5.2.9-zeo\zeocluster\src\addon.ini -O packagename.subpackagename bobtemplates.plone:addon

copy /Y con C:\Users\vagrant\Plone-5.2.9-zeo\zeocluster\src\theme_barceloneta.ini
[variables]
subtemplate_warning = n
theme.name = My Theme
package.git.init = False
package.git.autocommit: False
^Z

cd C:\Users\vagrant\Plone-5.2.9-zeo\zeocluster\src\packagename.subpackagename

C:\Users\vagrant\Plone-5.2.9-zeo\zeocluster\bin\mrbob --config C:\Users\vagrant\Plone-5.2.9-zeo\zeocluster\src\theme_barceloneta.ini -O packagename.subpackagename bobtemplates.plone:theme_barceloneta

Traceback (most recent call last):

  File "C:\users\vagrant\Plone-5.2.9\zeocluster\bin\mrbob-script.py", line 31, in <module>
    sys.exit(mrbob.cli.main())
  File "c:\users\vagrant\plone-5.2.9\buildout-cache\eggs\cp38m\mr.bob-0.1.2-py3.8.egg\mrbob\cli.py", line 181, in main
    c.render()
  File "c:\users\vagrant\plone-5.2.9\buildout-cache\eggs\cp38m\mr.bob-0.1.2-py3.8.egg\mrbob\configurator.py", line 196, in render
    render_structure(self.template_dir,
  File "c:\users\vagrant\plone-5.2.9\buildout-cache\eggs\cp38m\mr.bob-0.1.2-py3.8.egg\mrbob\rendering.py", line 94, in render_structure
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\Users\\vagrant\\Plone-5.2.9\\zeocluster\\src\\packagename.subpackagename\\src\\C:\\Users\\vagrant\\Plone-5'```

me-kell avatar Jul 24 '22 16:07 me-kell