Removed the references to packages no longer available in standard
python distributions (setuptools and distutils). Replaced the
version number parser and tree copy routines with more standard
(current) solutions.
diff --git a/common/foundry_install.py b/common/foundry_install.py
index 7d4ed66..b551b40 100755
--- a/common/foundry_install.py
+++ b/common/foundry_install.py
@@ -251,10 +251,7 @@
# %l : substitute the library name
# %% : substitute the percent character verbatim
-try:
- from setuptools.distutils.version import LooseVersion
-except:
- from distutils.version import LooseVersion
+from packaging import version
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
@@ -327,7 +324,7 @@
else:
for vlib in vlibs[1:]:
vtest = vlib[len(vglob)-1:]
- if LooseVersion(vtest) > LooseVersion(vstr):
+ if version.parse(vtest) > version.parse(vstr):
vstr = vtest
newpathname = re.sub('%v', vstr, newpathname)
diff --git a/common/staging_install.py b/common/staging_install.py
index 186a19e..a5285b8 100755
--- a/common/staging_install.py
+++ b/common/staging_install.py
@@ -76,11 +76,15 @@
import subprocess
# NOTE: This version of copy_tree from distutils works like shutil.copytree()
-# in Python 3.8 and up ONLY using "dirs_exist_ok=True".
-try:
- from setuptools.distutils.dir_util import copy_tree
-except:
- from distutils.dir_util import copy_tree
+# in Python 3.8 and up ONLY using "dirs_exist_ok=True". Since
+# distutils.dir_util has been deprecated and there are very few systems any
+# more using Python versions from 3.7 and earlier, I am removing this call
+# in favor of the shutil version.
+
+# try:
+# from setuptools.distutils.dir_util import copy_tree
+# except:
+# from distutils.dir_util import copy_tree
def makeuserwritable(filepath):
if os.path.exists(filepath):
@@ -464,8 +468,8 @@
remove_target(stagingdir, writedir)
print('Copying staging files to target')
- # print('Diagnostic: copy_tree ' + stagingdir + ' ' + writedir)
- copy_tree(stagingdir, writedir, preserve_symlinks=True, verbose=debug)
+ # print('Diagnostic: copytree ' + stagingdir + ' ' + writedir)
+ shutil.copytree(stagingdir, writedir, preserve_symlinks=True, verbose=debug, dirs_exist_ok=True)
print('Done.')
# Magic and qflow setup files have references to the staging area that have