Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision d745e74710ab581d489e815095d0dd4ee91e9c35 authored by Bryna Hazelton on 15 September 2025, 18:00:43 UTC, committed by Jonathan Pober on 15 September 2025, 18:31:58 UTC
remove macos-13 from our CI matrix because it is deprecated
1 parent ea19da5
  • Files
  • Changes
  • 0617af3
  • /
  • setup.py
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:d745e74710ab581d489e815095d0dd4ee91e9c35
directory badge
swh:1:dir:0617af386ff042ff5fcc8e805c814a3ac0e034ca
content badge
swh:1:cnt:2588d0de108a9dfa0f5dcf772a3d473970ec853a

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
setup.py
# Copyright (c) 2018 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License

import os
import platform
import sys
from sysconfig import get_config_var

import numpy
from Cython.Build import cythonize
from packaging.version import parse
from setuptools import Extension, setup


# define the branch scheme. Have to do it here so we don't have to modify the path
def branch_scheme(version):
    """
    Local version scheme that adds the branch name for absolute reproducibility.

    If and when this is added to setuptools_scm this function can be removed.
    """
    if version.exact or version.node is None:
        return version.format_choice("", "+d{time:{time_format}}", time_format="%Y%m%d")
    else:
        if version.branch == "main":
            return version.format_choice("+{node}", "+{node}.dirty")
        else:
            version_str = version.format_choice(
                "+{node}.{branch}", "+{node}.{branch}.dirty"
            )
            version_str = version_str.replace("/", ".")
            return version_str


def is_platform_mac():
    return sys.platform == "darwin"


def is_platform_windows():
    return sys.platform == "win32"


# For mac, ensure extensions are built for macos 10.9 when compiling on a
# 10.9 system or above, overriding distuitls behaviour which is to target
# the version that python was built for. This may be overridden by setting
# MACOSX_DEPLOYMENT_TARGET before calling setup.py
# implementation based on pandas, see https://github.com/pandas-dev/pandas/issues/23424
if is_platform_mac() and "MACOSX_DEPLOYMENT_TARGET" not in os.environ:
    current_system = parse(platform.mac_ver()[0])
    python_target = parse(get_config_var("MACOSX_DEPLOYMENT_TARGET"))
    if python_target < parse("10.9") and current_system >= parse("10.9"):
        os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.9"

# define the cython compile args, depending on platform
if is_platform_windows():
    extra_compile_args = ["/Ox", "/openmp"]
    extra_link_args = ["/openmp"]
elif is_platform_mac():
    extra_compile_args = ["-O3"]
    extra_link_args = []
else:
    extra_compile_args = ["-O3", "-fopenmp"]
    extra_link_args = ["-fopenmp"]

global_c_macros = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]

miriad_extension = Extension(
    "pyuvdata.uvdata._miriad",
    sources=[
        "src/pyuvdata/uvdata/src/miriad_wrap.pyx",
        "src/pyuvdata/uvdata/src/uvio.c",
        "src/pyuvdata/uvdata/src/hio.c",
        "src/pyuvdata/uvdata/src/pack.c",
        "src/pyuvdata/uvdata/src/bug.c",
        "src/pyuvdata/uvdata/src/dio.c",
        "src/pyuvdata/uvdata/src/headio.c",
        "src/pyuvdata/uvdata/src/maskio.c",
    ],
    define_macros=global_c_macros,
    include_dirs=["src/pyuvdata/uvdata/src/", numpy.get_include()],
)

corr_fits_extension = Extension(
    "pyuvdata.uvdata._corr_fits",
    sources=["src/pyuvdata/uvdata/corr_fits.pyx"],
    define_macros=global_c_macros,
    include_dirs=[numpy.get_include()],
    extra_compile_args=extra_compile_args,
    extra_link_args=extra_link_args,
)

coordinates_extension = Extension(
    "pyuvdata.utils._coordinates",
    sources=["src/pyuvdata/utils/coordinates.pyx"],
    define_macros=global_c_macros,
    include_dirs=[numpy.get_include()],
    extra_compile_args=extra_compile_args,
)

phasing_extension = Extension(
    "pyuvdata.utils._phasing",
    sources=["src/pyuvdata/utils/phasing.pyx"],
    define_macros=global_c_macros,
    include_dirs=[numpy.get_include()],
    extra_compile_args=extra_compile_args,
)

uvbeam_extension = Extension(
    "pyuvdata.uvbeam._uvbeam",
    sources=["src/pyuvdata/uvbeam/uvbeam.pyx"],
    define_macros=global_c_macros,
    include_dirs=[numpy.get_include()],
    extra_compile_args=extra_compile_args,
)

extensions = [
    corr_fits_extension,
    coordinates_extension,
    phasing_extension,
    uvbeam_extension,
]

# don't build miriad on windows
if not is_platform_windows():
    extensions.append(miriad_extension)

setup(
    use_scm_version={"local_scheme": branch_scheme},
    ext_modules=cythonize(extensions, language_level=3),
)
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API