Quickly prevents creating a project with a "-" or space in the name

Bug #493130 reported by Philip Peitsch
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Quickly
Fix Released
Undecided
Unassigned
quickly (Ubuntu)
Fix Released
Wishlist
Unassigned

Bug Description

Binary package hint: quickly

Attempting to create a quickly project with a "-" in the name is disallowed. I'm wondering why this is the case, as launchpad/bzr/etc. seem to allow creation of a project name such as this.

Related branches

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Thanks for using Quickly and making it better,

This issue is that we create a module named <yourapp> and Python doesn't allow - in module name (nor in functions, variables...). I guess that's something we will fix (removing - for the module name, taking care of classes and functions), but we will fix it later.
I'm setting it as a wishlist.

Changed in quickly (Ubuntu):
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Philip Peitsch (philip-peitsch) wrote :

Here is a patch to address this issue. The patch itself is quite large, but most of the content is in the po files.

The overall approach to fix this was to introduce another variable called "python_module". This is used in place of project_name in all the relevant python files and python file names. Another related change is that camel case and sentence case has been modified slightly as well. Dashes are replaced with spaces prior to performing capitalisation.

Name translations are similar to:

test-project
   Camel Case: TestProject
   Sentence Case: Testproject
   Python Module: testproject
   Project Name: test-project

I've tested the patch by creating both a project with a dashed name, and a normal one, and compared these manually to ensure no bad changes were made. I also tested project creation, running and patching.

Full bash log is:

cd ~/src
quickly create ubuntu-project testproject
cd testproject
quickly run
quickly package

cd ~/src
quickly create ubuntu-project test-project
cd test-project
quickly run
quickly package

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Thanks a lot for you patch, this will be a real gain :)

However, even applying successfully to latest trunk (rev 380), there are still some issues with your patch:
$ quickly create ubuntu-project My-Project
Creating project directory My-Project
Directory My-Project created

WARNING: No .quickly file found. Initiating a new one.
Création du répertoire du projet data
Répertoire data créé

Création du répertoire du projet myproject
Répertoire myproject créé

Création du répertoire du projet bin
Répertoire bin créé

Creating data/ui/MyProjectWindow.ui
data/ui/MyProjectWindow.ui created

Creating data/ui/myproject_window.xml
Traceback (most recent call last):
  File "/home/didrocks/Projets/quickly/quickly/data/templates/ubuntu-project/create.py", line 111, in <module>
    quicklyutils.file_from_template(template_ui_dir, "python_module_window.xml", target_ui_dir, substitutions)
  File "/home/didrocks/Projets/quickly/quickly/data/templates/ubuntu-project/internal/quicklyutils.py", line 48, in file_from_template
    fin = open(template_dir + template_file,'r')
IOError: [Errno 2] No such file or directory: '/home/didrocks/Projets/quickly/quickly/data/templates/ubuntu-project/data/ui/python_module_window.xml'
ERREUR: la commande create a échoué
Annulation

Can you please fix this (without your patch, the project creation is correct).
Also, if you can use bzr to propose a merge, it would be really great (if you don't know how to do or find it annoying, don't bother too much with that).

Thanks a lot :)

Revision history for this message
Philip Peitsch (philip-peitsch) wrote :

Hey... That failure has me puzzled! I've just pushed a branch up here with the changes, and proposed it for a merge: https://code.launchpad.net/~philip-peitsch/quickly/dashed-names-support

I've tried rebuilding and running exactly what you did, but mine appears to work properly.

Creating project directory My-test-Project
Directory My-test-Project created

WARNING: No .quickly file found. Initiating a new one.
Creating project directory data
Directory data created

Creating project directory mytestproject
Directory mytestproject created

Creating project directory bin
Directory bin created

Creating data/ui/MyTestProjectWindow.ui
data/ui/MyTestProjectWindow.ui created

Creating data/ui/mytestproject_window.xml
data/ui/mytestproject_window.xml created

Creating data/ui/AboutMyTestProjectDialog.ui
data/ui/AboutMyTestProjectDialog.ui created

Creating data/ui/about_mytestproject_dialog.xml
data/ui/about_mytestproject_dialog.xml created

Creating data/ui/PreferencesMyTestProjectDialog.ui
data/ui/PreferencesMyTestProjectDialog.ui created

Creating data/ui/preferences_mytestproject_dialog.xml
data/ui/preferences_mytestproject_dialog.xml created

Creating mytestproject/AboutMyTestProjectDialog.py
mytestproject/AboutMyTestProjectDialog.py created

Creating mytestproject/PreferencesMyTestProjectDialog.py
mytestproject/PreferencesMyTestProjectDialog.py created

Creating mytestproject/mytestprojectconfig.py
mytestproject/mytestprojectconfig.py created

I do notice that I'm only running an installed version (i.e., packaged and then installed via dpkg), where you appear to be running straight from the dev branch... I wonder if that has something to do with it perhaps. Are you able to check your /home/didrocks/Projets/quickly/quickly/data/templates/ubuntu-project/data/ui/ directory for me quickly and see what files are actually listed there? The other potential is that perhaps the rename didn't behave properly...

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

I've rewrote the import thing this morning (new head is rev 381) and I merged with your branche (only one line to merge : your WARNING: which should be removed. Indeed, we are planning now for Quickly 0.4, so a lot of changes happened since 0.2.6 :)
I still have the same error (only appearing when using dash version in project name)

Here is my
$ ls /home/didrocks/Projets/quickly/quickly/data/templates/ubuntu-project/data/ui/
Aboutcamel_case_nameDialog.ui camel_case_nameWindow.ui dialog_name_dialog.xml preferences_python_module_dialog.xml
about_python_module_dialog.xml dialog_camel_case_nameDialog.ui Preferencescamel_case_nameDialog.ui python_module_window.xml

Indeed, I run Quickly from trunk (I always took good care that Quickly can be runned from trunk and from packaged version, it's easier to test with that way).
Also the trunk now support symlinking the Quickly binary (for instance: "ln -s ~/quickly .../path/to/your/quickly/trunk" and then ~/quickly [command] would take all modules in the trunk) So, compatibility must be take care on.

I don't have the time to give a deeper look right now. I think the issue is quite easy to fix (normally, it should be "transparent" to create.py command, don't know what happen.

Try from the trunk: PATH=path/to/your/quickly/root/directory/bin:$PATH and check with "which quickly"
Do you get the same issue?

Revision history for this message
Philip Peitsch (philip-peitsch) wrote :

Ok... I have pulled the latest quickly branch (lp:quickly) into my branch. I fixed up the main project_name template so it functioned again, and everything now works again (on my machine... of course lol).

I then tested this my locally merging the trunk and my changes, and it seems to function ok.

Exact commands were:
bzr branch lp:quickly
cd quickly
bzr merge lp:~philip-peitsch/quickly/dashed-names-support

I then overrode the path so it used the freshly branched quickly and created a test project which worked (called My-Project). Give the merge another attempt and see if maybe it works for you too... sorry about all the back and forth :).. I appreciate you are busy with your own projects :)

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

See my comment in merge. Thanks a lot Philip!

Changed in quickly (Ubuntu):
status: Triaged → Fix Committed
status: Fix Committed → Triaged
summary: - Quickly prevents creating a project with a "-" in the name
+ Quickly prevents creating a project with a "-" or space in the name
Changed in quickly:
status: New → Fix Committed
milestone: none → 0.4
Changed in quickly:
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (6.7 KiB)

This bug was fixed in the package quickly - 0.3.90-0ubuntu1

---------------
quickly (0.3.90-0ubuntu1) lucid; urgency=low

  * New release:
    Quickly core:
    - check now that --template has one argument
    - -- enables to give options to templates (unknown options and arguments
      are still given to templates but -- specify explicity what to give to
      templates commands like -h, --version...)
    - check and enable recreation of the credential if user deletes it on
      Launchpad
    - Use realpath so that we can symlink to the binary in trunk.
      (Jonathan Lange)
    - project_path_not_found is raised when data_path_not_found should be
      (originated from Philip Peitsch's patch). (LP: #497688)
    - importing command in one template from another template is now possible
      support as well "all" keyword to import all commands from a template
      into another one (take care of overridden commands too)
      (LP: #452306, #487301)
    - add an apport hook to get installed templates (LP: #411127)
    - enable option completion for templates
    - handle now version upgrade, launching script for templates and handling
      versionning on them
    - change getstarted wording (LP: #486180) - Grant
    - Quickly ship now "version" tag instead of "format" tag
    - add some templatetools to check X display
    - if a commands exit with 4, do not show "ERROR:" (case of wrong command
      usage, for instance)
    - Rewrote importing module in both bin/quickly and ubuntu-project binary
    - Add get_camel_case_name() and get_sentence_name() to templatetools
    - Refactor some code in pre_create hook()
    - Now dashes and spaces support in project name! Dealing with python and
      packaging issues for you. (LP: #493130)
    - Provide Quickly API (LP: #426480)
    - Fix some issues in the man page
    ubuntu-application Template:
    - Enabling upload to team or user ppa, as well as any ppa.
      Use --ppa ppaname or --ppa team/ppaname
      .quickly file can be used as well with ppa = ppaname or
      ppa = team/ppaname (LP: #470192)
      ppa completion is also available
    - Change BSD header by full license
    - Add MIT license
    - Fixes an error when launchpad display name contains unicode character
      (Petar Vasić)
    - Fix typo in quickly help save (Petar Vasić)
    - Adds logo.png as logo property in about dialog (LP: #478389)
      (Petar Vasić)
    - Remove lp-project-change command and add configure command.
      configure lp-project [project_name] to set/reset lp project binded to
      your Quickly project
      ppa <ppa name> to set a default ppa with your project
    - Fix ~/.selected-editor being ignored (LP: #484730)
    - Fix wrong shell completion when in a template (it wrongly proposed
      all commands followed by templates)
    - Check if we have a X display available before running "run" or launching
      GUI in "create" command.
    - add -- support in quickly run to pass options like --help, --version so
      that Quickly core don't take them.
    - enable preferences save call being called multiple times (Philip Peitsch)
    - Use realpath so that we can symlink to the binary in trunk.
 ...

Read more...

Changed in quickly (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.