Skip to content

Commit

Permalink
replace distutils for python 3.12 (#362)
Browse files Browse the repository at this point in the history
Co-authored-by: Jarrett Johnson <[email protected]>
  • Loading branch information
branchvincent and JarrettSJohnson committed May 11, 2024
1 parent 195f4d1 commit 3d3c896
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
3 changes: 1 addition & 2 deletions create_shadertext.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from collections import defaultdict
from os.path import dirname
from subprocess import Popen, PIPE
from distutils import dir_util

def create_all(generated_dir, pymoldir="."):
'''
Expand All @@ -30,7 +29,7 @@ def __init__(self, filename):
self.out = cStringIO.StringIO()
self.filename = filename
else:
dir_util.mkpath(os.path.dirname(filename))
os.makedirs(os.path.dirname(filename), exist_ok=True)
self.out = open(filename, "w")
self.filename = None
def close(self):
Expand Down
7 changes: 3 additions & 4 deletions modules/pymol/plugins/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ def cmp_version(v1, v2):
'''
Compares two version strings. An empty version string is always considered
smaller than a non-empty version string.
Uses distutils.version.StrictVersion to evaluate non-empty version strings.
'''
if v1 == v2:
return 0
Expand All @@ -55,8 +53,9 @@ def cmp_version(v1, v2):
if v2 == '':
return 1
try:
from distutils.version import StrictVersion as Version
return cmp(Version(v1), Version(v2))
v1_parts = list(map(int, v1.split('.')))
v2_parts = list(map(int, v2.split('.')))
return (v1_parts > v2_parts) - (v1_parts < v2_parts)
except:
print(' Warning: Version parsing failed for', v1, 'and/or', v2)
return 0
Expand Down
1 change: 0 additions & 1 deletion testing/tests/system/pymolwin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import subprocess
import sys
import unittest
from distutils.spawn import find_executable
from pymol import cmd, CmdException, testing, stored

@unittest.skipIf(not sys.platform.startswith('win'), 'windows only')
Expand Down

0 comments on commit 3d3c896

Please sign in to comment.