Projet

Général

Profil

0001-misc-replace-deprecated-distutils-features-by-setupt.patch

Benjamin Dauvergne, 15 décembre 2022 17:55

Télécharger (2,06 ko)

Voir les différences:

Subject: [PATCH 1/5] misc: replace deprecated distutils features by setuptols
 or stdlib (#69991)

 setup.py | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
setup.py
1 1
#! /usr/bin/env python3
2 2

  
3 3
import os
4
import shutil
4 5
import subprocess
5 6
import sys
6
from distutils.cmd import Command
7
from distutils.command.build import build as _build
8
from distutils.command.sdist import sdist
9
from distutils.errors import CompileError
10
from distutils.spawn import find_executable
7

  
8
try:
9
    from setuptools import Command
10
    from setuptools.command.build import build as _build
11
    from setuptools.errors import CompileError
12
except ImportError:
13
    from distutils.cmd import Command
14
    from distutils.command.build import build as _build
15
    from distutils.errors import CompileError
11 16

  
12 17
from setuptools import find_packages, setup
13 18
from setuptools.command.install_lib import install_lib as _install_lib
19
from setuptools.command.sdist import sdist as _sdist
14 20

  
15 21
local_cfg = None
16 22
if os.path.exists('wcs/wcs_cfg.py'):
......
55 61
        pass
56 62

  
57 63
    def run(self):
58
        sass_bin = find_executable('sassc')
64
        sass_bin = shutil.which('sassc')
59 65
        if not sass_bin:
60 66
            raise CompileError('sassc is required but was not found.')
61 67

  
......
85 91
        _install_lib.run(self)
86 92

  
87 93

  
88
class eo_sdist(sdist):
94
class eo_sdist(_sdist):
89 95
    def run(self):
90 96
        if os.path.exists('VERSION'):
91 97
            os.remove('VERSION')
......
93 99
        version_file = open('VERSION', 'w')
94 100
        version_file.write(version)
95 101
        version_file.close()
96
        sdist.run(self)
102
        _sdist.run(self)
97 103
        if os.path.exists('VERSION'):
98 104
            os.remove('VERSION')
99 105

  
100
-