nephila / djangocms-installer

Console wizard to bootstrap django CMS projects

Home Page:https://djangocms-installer.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot handle spaces in project path

matthijskooijman opened this issue · comments

When the project path includes a space, the installer breaks:

matthijs@grubby:~/with space$ djangocms mysite
Creating the project
Please wait while I install dependencies
Dependencies installed
Creating the project
usage: django-admin.py startproject [-h] [--version] [-v {0,1,2,3}]
                                    [--settings SETTINGS]
                                    [--pythonpath PYTHONPATH] [--traceback]
                                    [--no-color] [--template TEMPLATE]
                                    [--extension EXTENSIONS] [--name FILES]
                                    name [directory]
django-admin.py startproject: error: unrecognized arguments: space/mysite
The installation has failed.

The problem comes from these lines: https://github.com/nephila/djangocms-installer/blob/develop/djangocms_installer/django/__init__.py#L56-L59

There, the command to run is joined into a single string, without proper escaping, and then passed to the shell to split again. There does not seem any point to this, since the argument is already nicely split and can be passed to subprocess as-is:

cmd_args = [sys.executable, start_cmd, 'startproject'] + args
if config_data.verbose:
    sys.stdout.write('Project creation command: {0}\n'.format(''.join(cmd_args)))
output = subprocess.check_output(cmd_args)

Thanks for reporting

Closed via #313