dev-python/agate: Bump to 1.13.0
[gentoo/gentoo.git] / sci-chemistry / pymol / files / pymol-3.0.0-distutils-py3.12.patch
blob3ab0384bd5f6ce735f0b28b23c65543a3a3c2ddc
1 From 3d3c8963798d426e70675c3c40df146e12869b0a Mon Sep 17 00:00:00 2001
2 From: Branch Vincent <branchevincent@gmail.com>
3 Date: Fri, 10 May 2024 22:12:58 -0700
4 Subject: [PATCH] replace distutils for python 3.12 (#362)
6 Co-authored-by: Jarrett Johnson <jarrett.johnson@schrodinger.com>
7 ---
8 create_shadertext.py | 3 +--
9 modules/pymol/plugins/installation.py | 7 +++----
10 testing/tests/system/pymolwin.py | 1 -
11 3 files changed, 4 insertions(+), 7 deletions(-)
13 diff --git a/create_shadertext.py b/create_shadertext.py
14 index 7bae72180..f6857087e 100644
15 --- a/create_shadertext.py
16 +++ b/create_shadertext.py
17 @@ -7,7 +7,6 @@
18 from collections import defaultdict
19 from os.path import dirname
20 from subprocess import Popen, PIPE
21 -from distutils import dir_util
23 def create_all(generated_dir, pymoldir="."):
24 '''
25 @@ -30,7 +29,7 @@ def __init__(self, filename):
26 self.out = cStringIO.StringIO()
27 self.filename = filename
28 else:
29 - dir_util.mkpath(os.path.dirname(filename))
30 + os.makedirs(os.path.dirname(filename), exist_ok=True)
31 self.out = open(filename, "w")
32 self.filename = None
33 def close(self):
34 diff --git a/modules/pymol/plugins/installation.py b/modules/pymol/plugins/installation.py
35 index 3a980545b..2fb8f6f03 100644
36 --- a/modules/pymol/plugins/installation.py
37 +++ b/modules/pymol/plugins/installation.py
38 @@ -45,8 +45,6 @@ def cmp_version(v1, v2):
39 '''
40 Compares two version strings. An empty version string is always considered
41 smaller than a non-empty version string.
43 - Uses distutils.version.StrictVersion to evaluate non-empty version strings.
44 '''
45 if v1 == v2:
46 return 0
47 @@ -55,8 +53,9 @@ def cmp_version(v1, v2):
48 if v2 == '':
49 return 1
50 try:
51 - from distutils.version import StrictVersion as Version
52 - return cmp(Version(v1), Version(v2))
53 + v1_parts = list(map(int, v1.split('.')))
54 + v2_parts = list(map(int, v2.split('.')))
55 + return (v1_parts > v2_parts) - (v1_parts < v2_parts)
56 except:
57 print(' Warning: Version parsing failed for', v1, 'and/or', v2)
58 return 0
59 diff --git a/testing/tests/system/pymolwin.py b/testing/tests/system/pymolwin.py
60 index 429fd28aa..e7885bd38 100644
61 --- a/testing/tests/system/pymolwin.py
62 +++ b/testing/tests/system/pymolwin.py
63 @@ -7,7 +7,6 @@
64 import subprocess
65 import sys
66 import unittest
67 -from distutils.spawn import find_executable
68 from pymol import cmd, CmdException, testing, stored
70 @unittest.skipIf(not sys.platform.startswith('win'), 'windows only')