collective / i18ndude

i18ndude performs various tasks related to ZPT's, Python Scripts and i18n.
https://pypi.org/project/i18ndude
4 stars 9 forks source link

Allow use of regular expressions for --exclude parameter #39

Closed laulaz closed 7 years ago

laulaz commented 8 years ago

This doesn't break existing behavior

pgrunewald commented 7 years ago

Looks good for me. I find this especially useful when trying to exclude certain subdirectories (populated by gulp, webpack, etc.)

Can we merge this, @mauritsvanrees?

mauritsvanrees commented 7 years ago

I thought I had reacted to this, but apparently not... Sorry about that!

I like the idea. And when I try it out, it works.

But I dislike having to use Python regular expressions on the command line. I did not realise how I needed to write it (of course I did not read the docs...) so it looked like it did not work.

How about using glob instead? For example, this is how that looks in the i18ndude top level folder:

>>> import glob
>>> glob.glob('*py')
['bootstrap.py', 'setup.py']
laulaz commented 7 years ago

@mauritsvanrees: Thanks for the suggestion ! I tried to change to glob today. But I figured out that then we cannot keep existing behavior easily.

Example : in many packages, we have --exclude="rss_template.pt metadata_edit_form.cpt metadirectives.py Discussion_Item.xml event.py"

This cannot be use as is with glob without changing or converting the expression.

I'm not feeling ready to make those changes ...

mauritsvanrees commented 7 years ago

@laulaz Can you check my pull request #40 which I based on your changes. It uses fnmatch instead of re or glob, as we were already using that module. It works fine for your use case as far as I can see.

mauritsvanrees commented 7 years ago

@laulaz @pgrunewald If you have time to check if my pull request #40 works for your use case, that would be good.

pgrunewald commented 7 years ago

It's perfectly fine for our use case.

mauritsvanrees commented 7 years ago

I have merged my pull request #40 and made release 4.1.