Import setuptools early to suppress distutils warning.
authorM. Eric Irrgang <ericirrgang@gmail.com>
Fri, 27 Nov 2020 14:24:01 +0000 (17:24 +0300)
committerM. Eric Irrgang <ericirrgang@gmail.com>
Fri, 27 Nov 2020 14:24:01 +0000 (17:24 +0300)
Also apply PEP-8 formatting corrections.

Fixes #3715

python_packaging/src/setup.py

index ff010604193ddac5b9e75d6f3e0dd1840e047bbf..42c9b95bba6e5285c7bb85ebd5086f423bec1452 100644 (file)
 
 import os
 
+# Import setuptools early to avoid UserWarning from Distutils.
+# Ref: https://gitlab.com/gromacs/gromacs/-/issues/3715
+import setuptools
+
 # Allow setup.py to be run when scikit-build is not installed, such as to
 # produce source distribution archives with `python setup.py sdist`
 try:
@@ -101,12 +105,14 @@ if gmxapi_DIR is None:
     # Infer from GMXRC exports, if available.
     gmxapi_DIR = os.getenv('GROMACS_DIR')
 
+
 def _find_first_gromacs_suffix(directory):
     dir_contents = os.listdir(directory)
     for entry in dir_contents:
         if entry.startswith('gromacs'):
             return entry.strip('gromacs')
 
+
 if gmx_toolchain_dir is None:
     # Try to guess from standard GMXRC environment variables.
     if gmxapi_DIR is not None: