Skip to content

Commit

Permalink
Attempt fixing platform detection for MacOS in setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
althonos committed Aug 16, 2023
1 parent f0c7cf1 commit 73659d8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 64 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ jobs:
runs-on: macos-latest
env:
OS: OSX
_PYTHON_HOST_PLATFORM: macosx-10.9-x86_64
strategy:
matrix:
include:
Expand Down
87 changes: 23 additions & 64 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,16 @@ def finalize_options(self):
self.target_system = _detect_target_system(self.plat_name)
self.target_cpu = _detect_target_cpu(self.plat_name)
# transfer arguments to the build_clib method
self._clib_cmd = self.get_finalized_command("build_clib")
self._clib_cmd = self.distribution.get_command_obj("build_clib", True)
self._clib_cmd.debug = self.debug
self._clib_cmd.force = self.force
self._clib_cmd.verbose = self.verbose
self._clib_cmd.define = self.define
self._clib_cmd.include_dirs = self.include_dirs
# self._clib_cmd.compiler = self.compiler
self._clib_cmd.parallel = self.parallel
self._clib_cmd.plat_name = self.plat_name
self._clib_cmd.target_machine = self.target_machine
self._clib_cmd.target_system = self.target_system
self._clib_cmd.target_cpu = self.target_cpu
self._clib_cmd.finalize_options()


def _check_getid(self):
_eprint('checking whether `PyInterpreterState_GetID` is available')
Expand Down Expand Up @@ -818,58 +816,6 @@ def run(self):
# --- C static libraries -----------------------------------------------------

# fmt: off
hmmer_sources = [
os.path.join("vendor", "hmmer", "src", basename)
for basename in [
"build.c", "cachedb.c", "cachedb_shard.c", "emit.c", "errors.c",
"evalues.c", "eweight.c", "generic_decoding.c", "generic_fwdback.c",
"generic_fwdback_chk.c", "generic_fwdback_banded.c", "generic_null2.c",
"generic_msv.c", "generic_optacc.c", "generic_stotrace.c",
"generic_viterbi.c", "generic_vtrace.c", "h2_io.c", "heatmap.c",
"hmmlogo.c", "hmmdmstr.c", "hmmdmstr_shard.c", "hmmd_search_status.c",
"hmmdwrkr.c", "hmmdwrkr_shard.c", "hmmdutils.c", "hmmer.c", "logsum.c",
"modelconfig.c", "modelstats.c", "mpisupport.c", "seqmodel.c",
"tracealign.c", "p7_alidisplay.c", "p7_bg.c", "p7_builder.c",
"p7_domain.c", "p7_domaindef.c", "p7_gbands.c", "p7_gmx.c",
"p7_gmxb.c", "p7_gmxchk.c", "p7_hit.c", "p7_hmm.c", "p7_hmmcache.c",
"p7_hmmd_search_stats.c", "p7_hmmfile.c", "p7_hmmwindow.c",
"p7_pipeline.c", "p7_prior.c", "p7_profile.c", "p7_spensemble.c",
"p7_tophits.c", "p7_trace.c", "p7_scoredata.c", "hmmpgmd2msa.c",
"fm_alphabet.c", "fm_general.c", "fm_sse.c", "fm_ssv.c",
]
]

# # HMMER3 is only supported on x86 CPUs with SSE, and big endian PowerPC
# # (see https://github.com/EddyRivasLab/hmmer/issues/142)
# machine = platform.machine().lower()
# if machine.startswith('ppc') and not machine.endswith('le'):
# hmmer_sources.extend(glob.glob(os.path.join("vendor", "hmmer", "src", "impl_vmx", "*.c")))
# hmmer_sources.remove(os.path.join("vendor", "hmmer", "src", "impl_vmx", "vitscore.c"))
# hmmer_impl = "VMX"
# platform_define_macros = [("eslENABLE_VMX", 1)]
# platform_compile_args = ["-maltivec"]
# elif machine.startswith(("x86", "amd", "i386", "i686")):
# hmmer_sources.extend(glob.glob(os.path.join("vendor", "hmmer", "src", "impl_sse", "*.c")))
# hmmer_sources.remove(os.path.join("vendor", "hmmer", "src", "impl_sse", "vitscore.c"))
# hmmer_impl = "SSE"
# platform_define_macros = [("eslENABLE_SSE", 1)]
# platform_compile_args = ["-msse4.1"]
# elif machine.lower().startswith(("arm", "aarch")):
# hmmer_sources.extend(glob.glob(os.path.join("vendor", "hmmer", "src", "impl_neon", "*.c")))
# hmmer_sources.remove(os.path.join("vendor", "hmmer", "src", "impl_neon", "vitscore.c"))
# hmmer_impl = "NEON"
# platform_define_macros = [("eslENABLE_NEON", 1)]
# platform_compile_args = [] if "64" in machine else ["-mfpu=neon"]
# else:
# _eprint('pyHMMER is not supported on CPU architecture:', repr(machine))
# platform_define_macros = []
# platform_compile_args = []
# hmmer_impl = None

platform_define_macros = []
platform_compile_args = []
hmmer_impl = None

libraries = [
Library(
"divsufsort",
Expand All @@ -882,7 +828,26 @@ def run(self):
),
Library(
"hmmer",
sources=hmmer_sources,
sources=[
os.path.join("vendor", "hmmer", "src", basename)
for basename in [
"build.c", "cachedb.c", "cachedb_shard.c", "emit.c", "errors.c",
"evalues.c", "eweight.c", "generic_decoding.c", "generic_fwdback.c",
"generic_fwdback_chk.c", "generic_fwdback_banded.c", "generic_null2.c",
"generic_msv.c", "generic_optacc.c", "generic_stotrace.c",
"generic_viterbi.c", "generic_vtrace.c", "h2_io.c", "heatmap.c",
"hmmlogo.c", "hmmdmstr.c", "hmmdmstr_shard.c", "hmmd_search_status.c",
"hmmdwrkr.c", "hmmdwrkr_shard.c", "hmmdutils.c", "hmmer.c", "logsum.c",
"modelconfig.c", "modelstats.c", "mpisupport.c", "seqmodel.c",
"tracealign.c", "p7_alidisplay.c", "p7_bg.c", "p7_builder.c",
"p7_domain.c", "p7_domaindef.c", "p7_gbands.c", "p7_gmx.c",
"p7_gmxb.c", "p7_gmxchk.c", "p7_hit.c", "p7_hmm.c", "p7_hmmcache.c",
"p7_hmmd_search_stats.c", "p7_hmmfile.c", "p7_hmmwindow.c",
"p7_pipeline.c", "p7_prior.c", "p7_profile.c", "p7_spensemble.c",
"p7_tophits.c", "p7_trace.c", "p7_scoredata.c", "hmmpgmd2msa.c",
"fm_alphabet.c", "fm_general.c", "fm_sse.c", "fm_ssv.c",
]
],
include_dirs=[
os.path.join("vendor", "easel"),
os.path.join("vendor", "hmmer", "src"),
Expand All @@ -904,24 +869,18 @@ def run(self):
"pyhmmer.easel",
[os.path.join("pyhmmer", "easel.pyx")],
libraries=["easel"],
define_macros=platform_define_macros,
extra_compile_args=platform_compile_args,
depends=glob.glob(os.path.join("pyhmmer", "fileobj", "*.h")),
),
Extension(
"pyhmmer.plan7",
[os.path.join("pyhmmer", "plan7.pyx")],
libraries=["hmmer", "easel", "divsufsort"],
define_macros=platform_define_macros,
extra_compile_args=platform_compile_args,
depends=glob.glob(os.path.join("pyhmmer", "fileobj", "*.h")),
),
Extension(
"pyhmmer.daemon",
[os.path.join("pyhmmer", "daemon.pyx")],
libraries=["hmmer", "easel", "divsufsort"],
define_macros=platform_define_macros,
extra_compile_args=platform_compile_args,
)
]

Expand Down

0 comments on commit 73659d8

Please sign in to comment.