Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add setup.py version plugin - #37

Merged
markchalloner merged 5 commits into
markchalloner:masterfrom
fernandocollova:add_setup.py_version_plugin
Apr 4, 2019
Merged

Add setup.py version plugin#37
markchalloner merged 5 commits into
markchalloner:masterfrom
fernandocollova:add_setup.py_version_plugin

Conversation

@fernandocollova

Copy link
Copy Markdown
Contributor

As discussed in #36, this is a plugin to keep the version of the setup.py file in a python project updated.

Any comments are welcomed, and thanks in advance for your time reviewing this.

Fernando

Comment thread plugins/10-setuppy_update.sh Outdated
fi

tmpfile=$(mktemp)
sed "s/version[[:blank:]]*=[[:blank:]]*[\",'][0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*[\",'][[:blank:]]*,/version=\"${version_new}\",/" < "${git_root}/setup.py" > "${tmpfile}"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of queries around this regex:

  • Are you sure you need the , in the character class [\",']?
  • I think you need to escape your full stops (.), otherwise this will match any character.
  • It might be worth documenting [0-9][0-9]* is for Mac compatibility.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Mark,

Thanks for your comments, and you are right about the , between the brackets, and escaping the dot, both were needed changes.

I also added a comment stating that I intentionally avoided using extended regular expressions for compatibility, so please let me know if you catch anything else that can be improved.

Thanks, Fernando

@markchalloner markchalloner left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me aside from the minor regex issue.

@markchalloner
markchalloner merged commit 88d180e into markchalloner:master Apr 4, 2019
markchalloner added a commit that referenced this pull request Apr 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants