Skip to content

Commit

Permalink
nit: code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mara004 committed Oct 2, 2023
1 parent 28be13b commit f143916
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion setupsrc/pypdfium2_setup/packaging_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ def __init__(self):

# Get information about the host platform (system and machine name)
# For the machine name, the platform module just passes through information provided by the OS (The uname command on Unix, or an equivalent implementation on other systems like Windows), so we can determine the relevant names from Python's source code, system specs or information available online (e. g. https://en.wikipedia.org/wiki/Uname)
# There is also sysconfig.get_platform() which we used before, but its behavior did not fully match our needs (esp. on macOS)
self._system_name = platform.system().lower()
self._machine_name = platform.machine().lower()

Expand Down
8 changes: 6 additions & 2 deletions setupsrc/pypdfium2_setup/setup_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class pypdfium_bdist (bdist_wheel):

def finalize_options(self, *args, **kws):
bdist_wheel.finalize_options(self, *args, **kws)
# root_is_pure: redundant, covered by BinaryDistribution below - TODO consider removal
self.root_is_pure = False

def get_tag(self, *args, **kws):
Expand All @@ -25,15 +26,16 @@ def get_tag(self, *args, **kws):
return pypdfium_bdist


# Use a custom distclass declaring we have a binary extension, to prevent modules from being nested in a purelib/ subdirectory in wheels
# Use a custom distclass declaring we have a binary extension, to prevent modules from being nested in a purelib/ subdirectory in wheels. This also sets `Root-Is-Purelib: false` in the WHEEL file.
class BinaryDistribution (setuptools.Distribution):
def has_ext_modules(self):
return True


# NOTE handle python_requires dynamically so we could adjust it depending on which modules are included
def get_setup_kws(modnames):

# NOTE Handle python_requires dynamically so we could adjust it depending on which modules are included

if set(modnames) == set(ModulesAll):
moddirs = {"": "src"}
else:
Expand All @@ -48,6 +50,8 @@ def get_setup_kws(modnames):

def mkwheel(pl_name, setup_kws):

# NOTE This will not be called for helpers-only installs

emplace_platfiles(pl_name)
system = plat_to_system(pl_name)
libname = LibnameForSystem[system]
Expand Down

0 comments on commit f143916

Please sign in to comment.