Skip to content

Commit f8c7109

Browse files
committed
Migrate to pyproject.toml
1 parent bdf3c98 commit f8c7109

4 files changed

Lines changed: 152 additions & 197 deletions

File tree

Makefile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ PYTHON = python3
2727
TESTCMD = $(PYTHON) -m unittest discover tests
2828
DISTDIR = $(BUILDDIR)/dist
2929

30-
DEPENDENCIES = f5-icontrol-rest requests_mock requests dict2xml ciscoisesdk
30+
DEPENDENCIES = f5-icontrol-rest requests_mock requests dict2xml ciscoisesdk
3131

3232
.PHONY: clean package distribute distribute_staging distribute_staging_external\
3333
develop undevelop populate_dist_dir help docs pubdocs tests
@@ -75,8 +75,7 @@ package:
7575

7676
# NOTE : Only specify --universal if the package works for both py2 and py3
7777
# https://packaging.python.org/en/latest/distributing.html#universal-wheels
78-
@$(PYTHON) setup.py bdist_wheel --dist-dir=$(DISTDIR)
79-
@$(PYTHON) setup.py sdist --dist-dir=$(DISTDIR)
78+
@$(PYTHON) -m build --wheel --outdir=$(DISTDIR)
8079

8180
@echo ""
8281
@echo "Completed building: $@"
@@ -91,8 +90,8 @@ develop:
9190
@echo ""
9291

9392
@pip uninstall -y rest.connector || true
94-
@pip install $(DEPENDENCIES)
95-
@$(PYTHON) setup.py develop --no-deps -q
93+
@pip install $(DEPENDENCIES) build
94+
@$(PYTHON) -m pip install -e . --no-deps
9695

9796
@echo ""
9897
@echo "Completed building and installing: $@"
@@ -106,7 +105,7 @@ undevelop:
106105
@echo "Uninstalling $(PKG_NAME) development distributable: $@"
107106
@echo ""
108107

109-
@./setup.py develop --no-deps -q --uninstall
108+
@$(PYTHON) -m pip uninstall -y $(PKG_NAME)
110109

111110
@echo ""
112111
@echo "Completed uninstalling: $@"
@@ -121,7 +120,9 @@ clean:
121120
@rm -rf $(BUILDDIR)
122121
@echo ""
123122
@echo "Removing build artifacts ..."
124-
@./setup.py clean
123+
@find . -type f -name "*.pyc" -delete
124+
@find . -type d -name "__pycache__" -prune -exec rm -rf {} +
125+
@find . -type d -name "build" -prune -exec rm -rf {} +
125126
@echo ""
126127
@echo "Done."
127128
@echo ""

meson.build

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Generated for direct meson-python packaging
2+
project(
3+
'rest.connector',
4+
meson_version: '>=1.10.0',
5+
)
6+
7+
fs = import('fs')
8+
pymod = import('python')
9+
package_folder = 'src'
10+
py = pymod.find_installation(pure: true)
11+
package_root = meson.project_source_root() / package_folder
12+
package_root_prefix = package_root + '/'
13+
git_prog = find_program('git')
14+
15+
# File extensions to include from tracked files under src/.
16+
# Expected values are bare extensions without a leading dot, for example: 'py', 'yaml', 'json'.
17+
include_extensions = ['py', 'yaml', 'txt']
18+
# Exact filenames to include when they do not rely on an extension match.
19+
# Expected values are basename matches, for example: 'ssh_host_key', 'runAll'.
20+
include_files = []
21+
# Substring markers for tracked paths that should still be ignored if they ever appear.
22+
# Expected values are path fragments, for example: '/generated/', '/vendor/', '.egg-info/'.
23+
ignored_path_markers = []
24+
25+
all_tracked_files = run_command(
26+
git_prog,
27+
'ls-files',
28+
package_folder,
29+
check: true,
30+
).stdout().strip().split('\n')
31+
32+
foreach relpath : all_tracked_files
33+
if relpath == ''
34+
continue
35+
endif
36+
37+
skip_path = false
38+
foreach marker : ignored_path_markers
39+
if relpath.contains(marker)
40+
skip_path = true
41+
break
42+
endif
43+
endforeach
44+
if skip_path
45+
continue
46+
endif
47+
48+
path_has_included_ext = false
49+
foreach extension : include_extensions
50+
if relpath.endswith('.' + extension)
51+
path_has_included_ext = true
52+
break
53+
endif
54+
endforeach
55+
56+
if not path_has_included_ext
57+
filename = fs.name(relpath)
58+
foreach include_name : include_files
59+
if filename == include_name
60+
path_has_included_ext = true
61+
break
62+
endif
63+
endforeach
64+
endif
65+
66+
if not path_has_included_ext
67+
continue
68+
endif
69+
70+
path = meson.project_source_root() / relpath
71+
relative_path = path.replace(package_root_prefix, '')
72+
install_target_dir = py.get_install_dir()
73+
relative_parent = fs.parent(relative_path)
74+
75+
if relative_parent != '.'
76+
install_target_dir = install_target_dir / relative_parent
77+
endif
78+
79+
install_data(
80+
path,
81+
install_dir: install_target_dir,
82+
)
83+
endforeach

pyproject.toml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
[build-system]
2+
requires = [
3+
"meson-python",
4+
"meson>=1.10.0",
5+
"ninja",
6+
]
7+
build-backend = "mesonpy"
8+
9+
[project]
10+
name = "rest.connector"
11+
version = "26.3"
12+
description = "pyATS REST connection package"
13+
readme = "DESCRIPTION.rst"
14+
requires-python = ">=3.9"
15+
authors = [
16+
{ name = "Cisco Systems Inc.", email = "pyats-support-ext@cisco.com" },
17+
]
18+
keywords = [
19+
"pyats",
20+
"rest",
21+
"connector",
22+
]
23+
classifiers = [
24+
"Development Status :: 5 - Production/Stable",
25+
"Environment :: Console",
26+
"Intended Audience :: Developers",
27+
"Intended Audience :: Telecommunications Industry",
28+
"Operating System :: MacOS",
29+
"Operating System :: POSIX :: Linux",
30+
"Programming Language :: Python :: 3",
31+
"Programming Language :: Python :: 3 :: Only",
32+
"Programming Language :: Python :: Implementation :: CPython",
33+
"Topic :: Software Development :: Testing",
34+
"Topic :: Software Development :: Build Tools",
35+
"Topic :: Software Development :: Libraries",
36+
"Topic :: Software Development :: Libraries :: Python Modules",
37+
]
38+
dependencies = [
39+
"requests >= 1.15.1",
40+
"dict2xml",
41+
"f5-icontrol-rest",
42+
"ciscoisesdk",
43+
]
44+
45+
[project.optional-dependencies]
46+
dev = [
47+
"coverage",
48+
"restview",
49+
"Sphinx",
50+
"sphinx-rtd-theme",
51+
"requests-mock",
52+
]
53+
54+
[project.urls]
55+
Homepage = "https://developer.cisco.com/pyats"
56+
57+
[tool.meson-python.wheel]
58+
include = [
59+
"*.py",
60+
"*.yaml",
61+
]

setup.py

Lines changed: 0 additions & 190 deletions
This file was deleted.

0 commit comments

Comments
 (0)