Projet

Général

Profil

0001-setup.py-adopt-a-more-PEP440-process-to-create-versi.patch

Benjamin Dauvergne, 19 janvier 2019 15:32

Télécharger (2,04 ko)

Voir les différences:

Subject: [PATCH] setup.py: adopt a more PEP440 process to create version
 (fixes #29918)

 setup.py | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
setup.py
75 75

  
76 76
def get_version():
77 77
    '''Use the VERSION, if absent generates a version with git describe, if not
78
       tag exists, take 0.0.0- and add the length of the commit log.
78
       tag exists, take 0.0- and add the length of the commit log.
79 79
    '''
80 80
    if os.path.exists('VERSION'):
81 81
        with open('VERSION', 'r') as v:
82 82
            return v.read()
83 83
    if os.path.exists('.git'):
84
        p = subprocess.Popen(['git', 'describe', '--dirty', '--match=v*'], stdout=subprocess.PIPE,
84
        p = subprocess.Popen(['git', 'describe', '--dirty=.dirty','--match=v*'], stdout=subprocess.PIPE,
85 85
                             stderr=subprocess.PIPE)
86 86
        result = p.communicate()[0]
87 87
        if p.returncode == 0:
88
            result = result.split()[0][1:]
88
            result = result.decode('ascii').strip()[1:]  # strip spaces/newlines and initial v
89
            if '-' in result:  # not a tagged version
90
                real_number, commit_count, commit_hash = result.split('-', 2)
91
                version = '%s.post%s+%s' % (real_number, commit_count, commit_hash)
92
            else:
93
                version = result
94
            return version
89 95
        else:
90
            result = '0.0.0-%s' % len(subprocess.check_output(
91
                ['git', 'rev-list', 'HEAD']).splitlines())
92
        return result.decode('utf-8').replace('-', '.').replace('.g', '+g')
93
    return '0.0.0'
96
            return '0.0.post%s' % len(
97
                subprocess.check_output(
98
                    ['git', 'rev-list', 'HEAD']).splitlines())
99
    return '0.0'
94 100

  
95 101

  
96 102
setup(name="authentic2",
97
-