Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
wmayner committed Jan 25, 2023
1 parent 9fa4993 commit 12862c3
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 25 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014-2017 Will Mayner
Copyright (c) 2014-2023 Will Mayner

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ test: build
py.test

build: clean
python setup.py build_ext -b .
python -m pip install -e .
# setup.py build_ext -b .

clean:
rm -f pyemd/*.so
rm -rf **/__pycache__
rm -rf build
rm -rf pyemd.egg-info

upload-dist: sign-dist
twine upload $(dist_dir)/*
Expand All @@ -28,7 +32,8 @@ check-dist: build-dist
twine check --strict dist/*

build-dist: clean-dist
python setup.py sdist bdist_wheel --dist-dir=$(dist_dir)
python -m build
# python -m setup.py sdist bdist_wheel --dist-dir=$(dist_dir)

clean-dist:
rm -rf $(dist_dir)
rm -r $(dist_dir)
24 changes: 24 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[build-system]
requires = ["setuptools>=61.0", "cython", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "pyemd"
version = "0.5.1"
authors = [{ name = "Will Mayner", email = "[email protected]" }]
description = "A Python wrapper for Ofir Pele and Michael Werman's implementation of the Earth Mover's Distance."
readme = "README.md"
license = { file = "LICENSE" }
classifiers = [
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
]
dynamic = ['dependencies']

[project.urls]
"Homepage" = "https://github.com/wmayner/pyemd"
"Bug Tracker" = "https://github.com/wmayner/pyemd/issues"
31 changes: 10 additions & 21 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def is_platform_mac():
# the version that Python was built for. This may be overridden by setting
# MACOSX_DEPLOYMENT_TARGET before calling setup.py
if is_platform_mac():
import packaging

if "MACOSX_DEPLOYMENT_TARGET" not in os.environ:
current_system = LooseVersion(platform.mac_ver()[0])
python_target = LooseVersion(get_config_var("MACOSX_DEPLOYMENT_TARGET"))
Expand Down Expand Up @@ -105,6 +107,8 @@ def finalize_options(self):
exec(f.read(), ABOUT)


REQUIRES = ["packaging"]

NUMPY_REQUIREMENT = [
"numpy >=1.9.0, <1.20.0; python_version<='3.6'",
"numpy >=1.9.0, <2.0.0; python_version>'3.6'",
Expand All @@ -119,34 +123,19 @@ def finalize_options(self):
try:
import numpy
except ImportError: # We do not have numpy installed
REQUIRES = NUMPY_REQUIREMENT
REQUIRES += NUMPY_REQUIREMENT
else:
# If we're building a wheel, assume there already exist numpy wheels
# for this platform, so it is safe to add numpy to build requirements.
# See scipy gh-5184.
REQUIRES = NUMPY_REQUIREMENT if "bdist_wheel" in sys.argv[1:] else []
if "bdist_wheel" in sys.argv[1:]:
REQUIRES += NUMPY_REQUIREMENT


setup(
name=ABOUT["__title__"],
version=ABOUT["__version__"],
description=ABOUT["__description__"],
long_description=README,
long_description_content_type="text/x-rst",
author=ABOUT["__author__"],
author_email=ABOUT["__author_email__"],
url=ABOUT["__url__"],
license=ABOUT["__license__"],
packages=["pyemd"],
packages=["pyemd", "pyemd.lib"],
install_requires=REQUIRES,
cmdclass=CMDCLASS,
setup_requires=REQUIRES,
ext_modules=EXT_MODULES,
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Natural Language :: English",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
],
cmdclass=CMDCLASS,
)

0 comments on commit 12862c3

Please sign in to comment.