marksteve / bump Goto Github PK
View Code? Open in Web Editor NEWBumps package versions
Home Page: https://pypi.python.org/pypi/bump
Bumps package versions
Home Page: https://pypi.python.org/pypi/bump
When cancelling or encountering other errors, bump
should exit with an error code.
$ bump package.json && git add . && commit -m "Bump version."
package.json: 0.2.0 => 0.2.1
Is this ok? y/n n
Cancelled.
[master b72572b] Bump version.
1 files changed
$ bump dummy_file.txt
No version definition found in dummy_file.txt
Is this ok? y/n
I suppose it's just missing a if len(matches) == 0: exit(1)
call somewhere.
$ cat expo/package.json
{
"name": "expo",
"version": "0.1.1",
"engines": { "node": ">=0.8.0" },
"dependencies": {
"commander": "1.1.x",
...snip
$ bump package.json
Traceback (most recent call last):
File "/Users/rsc/.zsh/bin/bump", line 122, in <module>
main()
File "/Users/rsc/.zsh/bin/bump", line 100, in main
match['bumped_version_string']))
ValueError: zero length field name in format
Given this xml document:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.myapp" version="0.9.3"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>MyApp<name>
....
</widget>
...doing bump config.xml
will bump <?xml version='1.0' ..?>
, not the intended version (version="0.9.3"
).
Hello!
I just tried bump. When there is a proper setup.py file, but with non-ascii characters (the encoding is declared on top of the file!), bump spits an error and overwrites the file with nothing.
Here's the traceback.
george@winterfell ~/projetos/corporativo/django-comum $ bump setup.py
setup.py: 1.0.1 => 1.0.2
Is this ok? y/n y
Traceback (most recent call last):
File "/usr/local/bin/bump", line 9, in <module>
load_entry_point('bump==0.3.0', 'console_scripts', 'bump')()
File "/usr/local/lib/python2.7/dist-packages/bump.py", line 123, in main
bumped_version_string + content[match['match'].end(1):])
UnicodeEncodeError: 'ascii' codec can't encode characters in position 138-139: ordinal not in range(128)
First, thanks for this little script.
I am getting tired of doing this plus my sphinx docs plus my package '--version' options all by hand.
I forked bump and plan to add automation to bumping the other places in a package that might need to reflect the version number as well.
If you like I will send you a pull request when I have it running.
Thanks again,
Gus
$ bump dummy_file.txt
No version definition found in dummy_file.txt
Is this ok? y/n
I suppose it's just missing a if len(matches) == 0: exit(1)
call somewhere.
Useful for ambiguous versions:
$ bump -v 0.8.0 package.json
package.json: 0.8.0pre => 0.8.0
Is this ok? y/n
Hey, here's some quick refactors you can do :-)
Your lines that look like:
print(filename, ':', match['version_string'], '=>', match['new_version_string'])
Are probably better written using string formatting:
print("%s: %s => %s" % (filename, match['version_string'], match['new_version_string']))
You can refactor if-else blocks to be less indented, like this one:
if __input('Is this ok? y/n ').lower() == 'y':
# ....
else:
print('Cancelled')
exit(1)
Which can be written better as:
if __input('Is this ok? y/n ').lower() != 'y':
print('Cancelled')
exit(1)
# ...
You can move some stuff into functions, like the argparser generation.
Here's a quick attempt to put these together. I posted this as a gist and not a pull request, it's more of a "hey check this out" kinda deal. :-)
Awesome work by the way!
It'd be nice to have the first line start with a shebang.
#!/usr/bin/env python
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.