EnterpriseDB / barman

Barman - Backup and Recovery Manager for PostgreSQL
https://www.pgbarman.org/
GNU General Public License v3.0
2.06k stars 191 forks source link

DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead. #870

Open mtelka opened 10 months ago

mtelka commented 10 months ago

While testing barman 3.9.0 I see many DeprecationWarning messages:

=============================== warnings summary =============================== 
tests/test_command_wrappers.py: 28 warnings
  $(@D)/barman/command_wrappers.py:767: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if version and version >= Version("9.3"):

tests/test_command_wrappers.py: 73 warnings
tests/test_compressor.py: 39 warnings
tests/test_executor.py: 15 warnings
tests/test_wal_archiver.py: 14 warnings
  $(PYTHON_DIR)/vendor-packages/setuptools/_distutils/version.py:345: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    other = LooseVersion(other)

tests/test_command_wrappers.py: 24 warnings
  $(@D)/barman/command_wrappers.py:955: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if version and version >= Version("10"):

tests/test_command_wrappers.py: 17 warnings
  $(@D)/barman/command_wrappers.py:1006: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if version and version >= Version("15"):

tests/test_command_wrappers.py: 2 warnings
tests/test_executor.py: 3 warnings
tests/test_wal_archiver.py: 6 warnings 
  $(@D)/barman/command_wrappers.py:894: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    version_info["full_version"] = Version(full_version)

tests/test_command_wrappers.py: 2 warnings
tests/test_executor.py: 3 warnings
tests/test_wal_archiver.py: 6 warnings
  $(@D)/barman/command_wrappers.py:895: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    version_info["major_version"] = Version(

tests/test_compressor.py::TestPgBaseBackupCompressionOption::test_validate[14-140000-compression_options2-expected_errors2]
tests/test_compressor.py::TestPgBaseBackupCompressionOption::test_validate[14-150000-compression_options3-expected_errors3]
tests/test_compressor.py::TestPgBaseBackupCompressionOption::test_validate[15-150000-compression_options6-expected_errors6]
tests/test_compressor.py::TestPgBaseBackupCompressionOption::test_validate[15-150000-compression_options8-expected_errors8]
tests/test_compressor.py::TestPgBaseBackupCompressionOption::test_validate[15-150000-compression_options9-expected_errors9]
  $(@D)/barman/compression.py:548: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if remote_status["pg_basebackup_version"] < Version("15"):

tests/test_compressor.py: 10 warnings
  $(@D)/barman/compression.py:586: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    ] < Version("15"):

tests/test_compressor.py: 10 warnings
  $(@D)/barman/compression.py:597: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    and remote_status["pg_basebackup_version"] >= Version("15")

tests/test_compressor.py::TestLZ4PgBaseBackupCompressionOption::test_validate[15-15000-compression_options0-expected_errors0]
tests/test_compressor.py::TestLZ4PgBaseBackupCompressionOption::test_validate[15-14000-compression_options1-expected_errors1]
tests/test_compressor.py::TestLZ4PgBaseBackupCompressionOption::test_validate[15-15000-compression_options2-expected_errors2]
tests/test_compressor.py::TestLZ4PgBaseBackupCompressionOption::test_validate[15-15000-compression_options3-expected_errors3]
tests/test_compressor.py::TestLZ4PgBaseBackupCompressionOption::test_validate[15-15000-compression_options4-expected_errors4]
tests/test_compressor.py::TestLZ4PgBaseBackupCompressionOption::test_validate[14-15000-compression_options5-expected_errors5]
tests/test_compressor.py::TestLZ4PgBaseBackupCompressionOption::test_validate[15-14000-compression_options6-expected_errors6]
  $(@D)/barman/compression.py:630: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if remote_status["pg_basebackup_version"] < Version("15"):

tests/test_compressor.py::TestZSTDPgBaseBackupCompressionOption::test_validate[15-15000-compression_options0-expected_errors0]
tests/test_compressor.py::TestZSTDPgBaseBackupCompressionOption::test_validate[15-14000-compression_options1-expected_errors1]
tests/test_compressor.py::TestZSTDPgBaseBackupCompressionOption::test_validate[15-14000-compression_options2-expected_errors2]
tests/test_compressor.py::TestZSTDPgBaseBackupCompressionOption::test_validate[15-15000-compression_options3-expected_errors3]
tests/test_compressor.py::TestZSTDPgBaseBackupCompressionOption::test_validate[15-15000-compression_options4-expected_errors4]
tests/test_compressor.py::TestZSTDPgBaseBackupCompressionOption::test_validate[14-15000-compression_options5-expected_errors5]
tests/test_compressor.py::TestZSTDPgBaseBackupCompressionOption::test_validate[14-15000-compression_options6-expected_errors6]
  $(@D)/barman/compression.py:666: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if remote_status["pg_basebackup_version"] < Version("15"):

tests/test_executor.py::TestPostgresBackupExecutor::test_check
tests/test_executor.py::TestPostgresBackupExecutor::test_check
tests/test_executor.py::TestPostgresBackupExecutor::test_check
tests/test_executor.py::TestPostgresBackupExecutor::test_check
  $(@D)/barman/backup_executor.py:451: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    pg_version = Version(postgres.server_txt_version)

tests/test_executor.py::TestPostgresBackupExecutor::test_fetch_remote_status
tests/test_executor.py::TestPostgresBackupExecutor::test_fetch_remote_status
  $(@D)/barman/backup_executor.py:547: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    pg_version = Version(pg_version)

tests/test_executor.py::TestSnapshotBackupExecutor::test_find_missing_and_unmounted_disks_resolve_exception
  $(@D)/barman/backup_executor.py:1594: DeprecationWarning: The 'warn' function is deprecated, use 'warning' instead
    logging.warn("Error resolving mount point: {}".format(exc))

tests/test_utils.py::TestBarmanEncoder::test_version_objects
  $(@D)/tests/test_utils.py:547: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    json_dump = json.dumps(LooseVersion("9.5.3"), cls=barman.utils.BarmanEncoder)

tests/test_utils.py::TestBarmanEncoderV2::test_version_objects
  $(@D)/tests/test_utils.py:638: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    json_dump = json.dumps(LooseVersion("9.5.3"), cls=barman.utils.BarmanEncoderV2)

tests/test_wal_archiver.py::TestStreamingWalArchiver::test_check_receivexlog_is_compatible
tests/test_wal_archiver.py::TestStreamingWalArchiver::test_check_receivexlog_is_compatible
tests/test_wal_archiver.py::TestStreamingWalArchiver::test_check_receivexlog_is_compatible
tests/test_wal_archiver.py::TestStreamingWalArchiver::test_check_receivexlog_is_compatible
tests/test_wal_archiver.py::TestStreamingWalArchiver::test_check_receivexlog_is_compatible
  $(@D)/barman/wal_archiver.py:695: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    pg_version = Version(pg_version)