packaging: write version in VERSION file (#34881)
This commit is contained in:
parent
e87527a2c4
commit
762cd93c6d
|
@ -2,3 +2,4 @@ recursive-include django_journal/locale *.po *.mo
|
||||||
recursive-include django_journal/static *.css *.png
|
recursive-include django_journal/static *.css *.png
|
||||||
include MANIFEST.in
|
include MANIFEST.in
|
||||||
include README.rst
|
include README.rst
|
||||||
|
include VERSION
|
||||||
|
|
21
setup.py
21
setup.py
|
@ -6,7 +6,7 @@ import sys
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
from setuptools.command.install_lib import install_lib as _install_lib
|
from setuptools.command.install_lib import install_lib as _install_lib
|
||||||
from distutils.command.build import build as _build
|
from distutils.command.build import build as _build
|
||||||
from setuptools.command.sdist import sdist as _sdist
|
from setuptools.command.sdist import sdist
|
||||||
from distutils.cmd import Command
|
from distutils.cmd import Command
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,16 +60,25 @@ class build(_build):
|
||||||
sub_commands = [('compile_translations', None)] + _build.sub_commands
|
sub_commands = [('compile_translations', None)] + _build.sub_commands
|
||||||
|
|
||||||
|
|
||||||
class sdist(_sdist):
|
|
||||||
sub_commands = [('compile_translations', None)] + _sdist.sub_commands
|
|
||||||
|
|
||||||
|
|
||||||
class install_lib(_install_lib):
|
class install_lib(_install_lib):
|
||||||
def run(self):
|
def run(self):
|
||||||
self.run_command('compile_translations')
|
self.run_command('compile_translations')
|
||||||
_install_lib.run(self)
|
_install_lib.run(self)
|
||||||
|
|
||||||
|
|
||||||
|
class eo_sdist(sdist):
|
||||||
|
def run(self):
|
||||||
|
if os.path.exists('VERSION'):
|
||||||
|
os.remove('VERSION')
|
||||||
|
version = get_version()
|
||||||
|
version_file = open('VERSION', 'w')
|
||||||
|
version_file.write(version)
|
||||||
|
version_file.close()
|
||||||
|
sdist.run(self)
|
||||||
|
if os.path.exists('VERSION'):
|
||||||
|
os.remove('VERSION')
|
||||||
|
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
'''Use the VERSION, if absent generates a version with git describe, if not
|
'''Use the VERSION, if absent generates a version with git describe, if not
|
||||||
tag exists, take 0.0- and add the length of the commit log.
|
tag exists, take 0.0- and add the length of the commit log.
|
||||||
|
@ -112,7 +121,7 @@ setup(name='django-journal',
|
||||||
'build': build,
|
'build': build,
|
||||||
'install_lib': install_lib,
|
'install_lib': install_lib,
|
||||||
'compile_translations': compile_translations,
|
'compile_translations': compile_translations,
|
||||||
'sdist': sdist,
|
'sdist': eo_sdist,
|
||||||
'test': test
|
'test': test
|
||||||
},
|
},
|
||||||
install_requires=[
|
install_requires=[
|
||||||
|
|
Loading…
Reference in New Issue