Skip to content

Commit

Permalink
Revert "fix setuptools module in DisplayCAL/setup.py"
Browse files Browse the repository at this point in the history
This reverts commit 4ea5bca.
  • Loading branch information
eoyilmaz committed Nov 21, 2022
1 parent 06a925d commit acc89e5
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions DisplayCAL/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ def setup():
prefix = ""
recordfile_name = None # record installed files to this file
sdist = "sdist" in sys.argv[1:]
setuptools = None
skip_postinstall = "--skip-postinstall" in sys.argv[1:]
use_distutils = not bdist_bbfreeze and not do_py2app
use_setuptools = (
Expand All @@ -479,10 +480,10 @@ def setup():
import setuptools
from setuptools import setup, Extension

setuptools = True
print("using setuptools")
current_findall = setuptools.findall
except ImportError:
use_setuptools = False
pass
else:
if os.path.exists("use-setuptools"):
Expand All @@ -508,7 +509,7 @@ def findall(

distutils.filelist.findall = findall

if not use_setuptools:
if not setuptools:
from distutils.core import setup, Extension

print("using distutils")
Expand Down Expand Up @@ -944,7 +945,7 @@ def findall(
ext_modules = [RealDisplaySizeMM]

requires = []
if not use_setuptools or sys.platform != "win32":
if not setuptools or sys.platform != "win32":
# wxPython windows installer doesn't add egg-info entry, so
# a dependency check from pkg_resources would always fail
requires.append("wxPython (>= %s)" % ".".join(str(n) for n in wx_minversion))
Expand Down Expand Up @@ -1020,7 +1021,7 @@ def findall(
"version": msiversion if "bdist_msi" in sys.argv[1:] else version,
}

if use_setuptools:
if setuptools:
attrs["entry_points"] = {
"gui_scripts": [
"%s = %s.main:main%s"
Expand Down Expand Up @@ -1277,7 +1278,7 @@ def copy_package_data(self, package, target_dir):
attrs["options"]["py2exe"].update(
{"bundle_files": 3, "compressed": 0, "optimize": 0, "skip_archive": 1}
)
if use_setuptools:
if setuptools:
attrs["setup_requires"] = ["py2exe"]
attrs["zipfile"] = os.path.join("lib", "library.zip")

Expand Down Expand Up @@ -1327,10 +1328,10 @@ def copy_package_data(self, package, target_dir):
# site-packages (on Mac and Windows) and when we want to make them
# absolute (Linux)
linux = sys.platform not in ("darwin", "win32") and (
not cmd.root and use_setuptools
not cmd.root and setuptools
)
dar_win = (
sys.platform in ("darwin", "win32") and (cmd.root or not use_setuptools)
sys.platform in ("darwin", "win32") and (cmd.root or not setuptools)
) or bdist_win
if (
not do_uninstall
Expand Down Expand Up @@ -1379,7 +1380,7 @@ def copy_package_data(self, package, target_dir):
# logic to find them
paths = safe_glob(os.path.join(cmd.install_scripts, name))
if sys.platform == "win32":
if use_setuptools:
if setuptools:
paths += safe_glob(os.path.join(cmd.install_scripts, f"{name}.exe"))
paths += safe_glob(
os.path.join(cmd.install_scripts, f"{name}-script.py")
Expand Down Expand Up @@ -1586,7 +1587,7 @@ def copy_package_data(self, package, target_dir):
manifest_in.append("include " + os.path.join("tests", "*"))
manifest_in.append("recursive-include theme *")
manifest_in.append("recursive-include util *.cmd *.py *.sh")
if sys.platform == "win32" and not use_setuptools:
if sys.platform == "win32" and not setuptools:
# Only needed under Windows
manifest_in.append("global-exclude .svn/*")
manifest_in.append("global-exclude *~")
Expand Down

0 comments on commit acc89e5

Please sign in to comment.