BumpCommand¶
-
class
privex.helpers.setuppy.commands.
BumpCommand
(dist)[source]¶ Distutils/setup.py command class for bumping the package version using
bump_version()
Usage in setup.py:
from setuptools import setup, find_packages from privex.helpers import settings, BumpCommand # The file which contains "VERSION = '1.2.3'" settings.VERSION_FILE = '/home/john/mypackage/mypackage/__init__.py' setup( cmdclass={ 'bump': BumpCommand }, );
Usage on the command line:
./setup.py bump --patch # Bumping 'patch' version part # Updating version stored in file @ /tmp/helpers/privex/helpers/__init__.py # Package version has been bumped from 2.0.0 to 2.0.1 and written to the file # /tmp/helpers/privex/helpers/__init__.py ./setup.py bump --minor # ... version has been bumped from 2.0.0 to 2.1.0 and written to the file ... ./setup.py bump --pre # ... version has been bumped from 2.1.0 to 2.1.0-rc.1 ... ./setup.py bump --build # ... version has been bumped from 2.2.0 to 2.2.0+build.1 ...
The options
--pre
and--build
also allow an extra option--token=xxx
which allows you to change the token from the respective-rc.x
and+build.x
to your own label.If a token is found in the version string, then it will automatically use the one in the version string until you either clean off the pre/build suffixes with a normal version bump e.g.
--patch
or you manually remove the suffixes from the version number in the file.# NOTE: to change the suffix token, the version must be plain x.y.z without -xxx.y appended. ./setup.py bump --pre --token=alpha # ... version has been bumped from 2.1.0 to 2.1.0-alpha.1 ... ./setup.py bump --pre # ... version has been bumped from 2.1.0-alpha.1 to 2.1.0-alpha.2 ...
-
__init__
(dist) Create and initialize a new Command object. Most importantly, invokes the ‘initialize_options()’ method, which is the real initializer and depends on the actual command being instantiated.
-
Methods¶
Methods
Set final values for all the options that this command supports. |
|
Set default values for all the options that this command supports. |
|
|
A command’s raison d’etre: carry out the action it exists to perform, controlled by the options initialized in ‘initialize_options()’, customized by other commands, the setup script, the command-line, and config files, and finalized in ‘finalize_options()’. |
Attributes¶
Attributes
Option arguments which can be specified by the user on the command line for this command |