Merge "Don't wrap develop on newer setuptools"

This commit is contained in:
Zuul
2025-10-31 18:29:10 +00:00
committed by Gerrit Code Review
3 changed files with 40 additions and 12 deletions

View File

@@ -16,6 +16,7 @@
from __future__ import absolute_import
from __future__ import print_function
import pbr._compat.versions
from pbr.hooks import base
from pbr import options
@@ -39,9 +40,12 @@ class CommandsConfig(base.BaseConfig):
self.add_command('pbr._compat.commands.LocalEggInfo')
self.add_command('pbr._compat.commands.LocalSDist')
self.add_command('pbr._compat.commands.LocalInstallScripts')
self.add_command('pbr._compat.commands.LocalDevelop')
self.add_command('pbr._compat.commands.LocalRPMVersion')
self.add_command('pbr._compat.commands.LocalDebVersion')
if pbr._compat.versions.setuptools_has_develop_command:
self.add_command('pbr._compat.commands.LocalDevelop')
use_egg = options.get_boolean_option(
self.pbr_config, 'use-egg', 'PBR_USE_EGG'
)

View File

@@ -22,7 +22,6 @@ import os
import sys
import setuptools
from setuptools.command import develop
from setuptools.command import egg_info
from setuptools.command import install
from setuptools.command import install_scripts
@@ -30,24 +29,30 @@ from setuptools.command import sdist
import pbr._compat.easy_install
import pbr._compat.metadata
import pbr._compat.versions
from pbr import extra_files
from pbr import git
from pbr import options
from pbr import version
class LocalDevelop(develop.develop):
if pbr._compat.versions.setuptools_has_develop_command:
from setuptools.command import develop
command_name = 'develop'
class LocalDevelop(develop.develop):
def install_wrapper_scripts(self, dist):
if sys.platform == 'win32':
return develop.develop.install_wrapper_scripts(self, dist)
if not self.exclude_scripts:
for args in pbr._compat.easy_install.ScriptWriter.get_script_args(
dist
):
self.write_script(*args)
command_name = 'develop'
def install_wrapper_scripts(self, dist):
if sys.platform == 'win32':
return develop.develop.install_wrapper_scripts(self, dist)
if not self.exclude_scripts:
for (
args
) in pbr._compat.easy_install.ScriptWriter.get_script_args(
dist
):
self.write_script(*args)
class LocalInstallScripts(install_scripts.install_scripts):

19
pbr/_compat/versions.py Normal file
View File

@@ -0,0 +1,19 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from pbr import version
setuptools_version = version.VersionInfo('setuptools').semantic_version()
setuptools_has_develop_command = setuptools_version < version.SemanticVersion(
80, 0, 0
)