Code

Opened 6 years ago

Closed 4 years ago

#6380 closed (fixed)

make-messages.py don't follow symlinks

Reported by: Adrian <aribao@…> Owned by: nobody
Component: Internationalization Version: master
Severity: Keywords: make-messages symlinks follow symbolic links
Cc: aribao@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:

Description

I have created a repository with my apps, and when I need one for one of my projects, I link the code from the repository to the project path. This give me a problem.
When I want to use make-messages to extract all the translation strings, it doesn't follow this symbolic links.
I have patched make-messages.py to be able to extract the strings from the applications linked to the project.
I hope it helps.

Attachments (1)

make-messages.py.diff (1.0 KB) - added by Adrian <aribao@…> 6 years ago.
Patch to allow make-messages.py follow symbolic links

Download all attachments as: .zip

Change History (6)

Changed 6 years ago by Adrian <aribao@…>

Patch to allow make-messages.py follow symbolic links

comment:1 Changed 6 years ago by Simon Greenhill <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 6 years ago by aribao@…

I'd like to make some improvements in this patch, what should I do? Something missing?
Thank you.

comment:3 Changed 6 years ago by mtredinnick

If you want to upload a new patch, just do so. We'll only ever worry about the last patch.

There are a few improvements needed here, though:

  1. It doesn't need a nested function like this. Just declare a top-level function. It's much easier to read because there's no confusion about which code belongs to which function.
  2. Needs to be formatted as per PEP 8. In particular, no spaces after parentheses and spaces after commas.
  3. You seem to be going to a lot of effort to reinvent the behaviour of os.walk here. Why not just continue to use os.walk() to descend the directories and use the tip in the Python docs for os.walk for handling symlinks? That would require less extra code, I suspect, plus will use the already debugged os.walk() function instead of having to reinvent our own version.

comment:4 Changed 4 years ago by ramiro

The followlinks parameter of os.walk() was added in Python 2.6.

comment:5 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

(In [12443]) Fixed #6380 - Follow symlinks when examining source code and templates for translation strings.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.