more stuff :D
This commit is contained in:
parent
cfe78709ac
commit
df177b96c1
3
LICENSE
3
LICENSE
|
@ -1,3 +1,6 @@
|
||||||
|
Incremental
|
||||||
|
-----------
|
||||||
|
|
||||||
This project includes code from the Twisted Project, which is licensed as below.
|
This project includes code from the Twisted Project, which is licensed as below.
|
||||||
|
|
||||||
Copyright (c) 2001-2015
|
Copyright (c) 2001-2015
|
||||||
|
|
64
README.rst
64
README.rst
|
@ -1,4 +1,66 @@
|
||||||
Incremental
|
Incremental
|
||||||
===========
|
===========
|
||||||
|
|
||||||
Incremental is a small library that versions your projects.
|
Incremental is a small library that versions your Python projects.
|
||||||
|
|
||||||
|
|
||||||
|
Quick Start
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Add this to the top of your ``setup.py``, assuming your code is called ``widgetbox``:
|
||||||
|
|
||||||
|
.. code::
|
||||||
|
|
||||||
|
my_project = 'widgetbox'
|
||||||
|
|
||||||
|
import os, importlib
|
||||||
|
|
||||||
|
def install_incremental():
|
||||||
|
import importlib
|
||||||
|
try:
|
||||||
|
importlib.import_module('incremental')
|
||||||
|
except ImportError:
|
||||||
|
import pip
|
||||||
|
pip.main(['install', 'incremental>=0.1.0'])
|
||||||
|
finally:
|
||||||
|
globals()['incremental'] = importlib.import_module('incremental')
|
||||||
|
|
||||||
|
install_incremental()
|
||||||
|
|
||||||
|
# PICK ONE OF:
|
||||||
|
# If you have a src/ dir
|
||||||
|
base_dir = os.path.dirname(__file__)
|
||||||
|
src_dir = os.path.join(base_dir, "src")
|
||||||
|
# If you do not
|
||||||
|
src_dir = os.path.dirname(__file__)
|
||||||
|
|
||||||
|
version = incremental.get_version_from_project(my_project, src_dir)
|
||||||
|
|
||||||
|
And in the ``setup`` call, add:
|
||||||
|
|
||||||
|
.. code::
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name=my_project,
|
||||||
|
version=version.base(),
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
Then in your project add a ``_version.py`` that contains:
|
||||||
|
|
||||||
|
.. code::
|
||||||
|
|
||||||
|
from incremental import Version
|
||||||
|
|
||||||
|
__version__ = Version("widgetbox", 1, 2, 3)
|
||||||
|
__all__ = ["__version__"]
|
||||||
|
|
||||||
|
|
||||||
|
Then in your project's ``__init__.py`` add:
|
||||||
|
|
||||||
|
.. code::
|
||||||
|
|
||||||
|
from ._version import __version__
|
||||||
|
|
||||||
|
|
||||||
|
Subsequent installations of your project will use incremental for versioning.
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
my_project = 'exampleproj'
|
||||||
|
|
||||||
|
import os, importlib
|
||||||
|
|
||||||
|
def install_incremental():
|
||||||
|
import importlib
|
||||||
|
try:
|
||||||
|
importlib.import_module('incremental')
|
||||||
|
except ImportError:
|
||||||
|
import pip
|
||||||
|
pip.main(['install', 'incremental>=15.0.0'])
|
||||||
|
finally:
|
||||||
|
globals()['incremental'] = importlib.import_module('incremental')
|
||||||
|
|
||||||
|
install_incremental()
|
||||||
|
|
||||||
|
# PICK ONE OF:
|
||||||
|
# If you have a src/ dir
|
||||||
|
base_dir = os.path.dirname(__file__)
|
||||||
|
src_dir = os.path.join(base_dir, "src")
|
||||||
|
version = incremental.get_version_from_project(my_project, src_dir)
|
||||||
|
|
||||||
|
# Install the package
|
||||||
|
|
||||||
|
from setuptools import setup
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name=my_project,
|
||||||
|
version=version.base()
|
||||||
|
)
|
2
setup.py
2
setup.py
|
@ -17,6 +17,8 @@ import incremental
|
||||||
setup(
|
setup(
|
||||||
name='incremental',
|
name='incremental',
|
||||||
version=incremental.__version__.base(),
|
version=incremental.__version__.base(),
|
||||||
|
maintainer='Amber Brown',
|
||||||
|
maintainer_email='hawkowl@twistedmatrix.com',
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Intended Audience :: Developers",
|
"Intended Audience :: Developers",
|
||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
from ._version import __version__
|
|
@ -0,0 +1,4 @@
|
||||||
|
from incremental import Version
|
||||||
|
|
||||||
|
__version__ = Version("exampleproj", 1, 2, 3)
|
||||||
|
__all__ = ["__version__"]
|
|
@ -403,6 +403,18 @@ def getVersionString(version):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
__version__ = Version("incremental", 0, 1, 0)
|
def get_version_from_project(project, src_dir):
|
||||||
|
"""
|
||||||
|
Get a L{Version} object from a flat source directory.
|
||||||
|
"""
|
||||||
|
version_file = {}
|
||||||
|
|
||||||
__all__ = ["__version__", "Version"]
|
with open(os.path.join(src_dir, project, "_version.py")) as f:
|
||||||
|
exec(f.read(), version_file)
|
||||||
|
|
||||||
|
return version_file["__version__"]
|
||||||
|
|
||||||
|
|
||||||
|
__version__ = Version("incremental", 15, 0, 0)
|
||||||
|
|
||||||
|
__all__ = ["__version__", "Version", "get_version_from_project"]
|
||||||
|
|
Loading…
Reference in New Issue