Projet

Général

Profil

0001-packaging-write-version-in-VERSION-file-34881.patch

Emmanuel Cazenave, 15 juillet 2019 18:12

Télécharger (2,2 ko)

Voir les différences:

Subject: [PATCH] packaging: write version in VERSION file (#34881)

 MANIFEST.in |  1 +
 setup.py    | 21 +++++++++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)
MANIFEST.in
2 2
recursive-include django_journal/static *.css *.png
3 3
include MANIFEST.in
4 4
include README.rst
5
include VERSION
setup.py
6 6
from setuptools import setup, find_packages
7 7
from setuptools.command.install_lib import install_lib as _install_lib
8 8
from distutils.command.build import build as _build
9
from setuptools.command.sdist import sdist as _sdist
9
from setuptools.command.sdist import sdist
10 10
from distutils.cmd import Command
11 11

  
12 12

  
......
60 60
    sub_commands = [('compile_translations', None)] + _build.sub_commands
61 61

  
62 62

  
63
class sdist(_sdist):
64
    sub_commands = [('compile_translations', None)] + _sdist.sub_commands
65

  
66

  
67 63
class install_lib(_install_lib):
68 64
    def run(self):
69 65
        self.run_command('compile_translations')
70 66
        _install_lib.run(self)
71 67

  
72 68

  
69
class eo_sdist(sdist):
70
    def run(self):
71
        if os.path.exists('VERSION'):
72
            os.remove('VERSION')
73
        version = get_version()
74
        version_file = open('VERSION', 'w')
75
        version_file.write(version)
76
        version_file.close()
77
        sdist.run(self)
78
        if os.path.exists('VERSION'):
79
            os.remove('VERSION')
80

  
81

  
73 82
def get_version():
74 83
    '''Use the VERSION, if absent generates a version with git describe, if not
75 84
       tag exists, take 0.0- and add the length of the commit log.
......
112 121
          'build': build,
113 122
          'install_lib': install_lib,
114 123
          'compile_translations': compile_translations,
115
          'sdist': sdist,
124
          'sdist': eo_sdist,
116 125
          'test': test
117 126
      },
118 127
      install_requires=[
119
-