From e3eae5df830e7c53d0d6fd38b55bff648aeec37a Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Sun, 3 Nov 2019 15:09:45 -0600
Subject: [PATCH 19/30] Use ranlib from env if env variable is set

---

diff --git a/setuptools/_distutils/sysconfig.py b/setuptools/_distutils/sysconfig.py
index aae9c1b..469ed85 100644
--- a/setuptools/_distutils/sysconfig.py
+++ b/setuptools/_distutils/sysconfig.py
@@ -339,6 +339,9 @@ def customize_compiler(compiler):  # noqa: C901
         if 'RANLIB' in os.environ and compiler.executables.get('ranlib', None):
             compiler.set_executables(ranlib=os.environ['RANLIB'])

+        if 'RANLIB' in os.environ and 'ranlib' in compiler.executables:
+            compiler.set_executables(ranlib=os.environ['RANLIB'])
+
         compiler.shared_lib_extension = shlib_suffix

