Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pyproject.toml instead of old setup.py #616

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ repos:
rev: 6.0.0
hooks:
- id: flake8
language: python
additional_dependencies:
- flake8-bugbear
- flake8-builtins
Expand All @@ -13,10 +14,13 @@ repos:
rev: 23.1.0
hooks:
- id: black
language: python
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
hooks:
- id: mypy
language: python
args: ['--explicit-package-bases']
files: '\.py$'
exclude: '^tests/.+$'
additional_dependencies:
Expand Down
6 changes: 6 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,9 @@ ignore_missing_imports = True

[mypy-requests_cache.*]
ignore_missing_imports = True

[mypy-packaging.*]
ignore_missing_imports = True

[mypy-importlib_resources.*]
ignore_missing_imports = True
76 changes: 76 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "e3-core"
description = "E3 core. Tools and library for building and testing software"
requires-python = ">=3.9"
license = {text = "GPLv3"}
authors = [{name = "AdaCore", email = "[email protected]"}]
keywords = ["AdaCore", "Production", "SSC", "Supply chain", "Build"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"License :: AdaCore internal",
"Topic :: Software Development :: Build Tool",
]
dependencies = [
"colorama",
"pyyaml",
"python-dateutil",
"requests",
"requests_toolbelt",
"tqdm",
"stevedore>1.20.0",
"setuptools",
"ld; platform_system=='Linux'",
"psutil; sys_platform=='darwin' or sys_platform=='linux' or sys_platform=='linux2' or sys_platform=='win32'"
]
dynamic = ["version"]

[tool.setuptools.dynamic]
version = {file = "VERSION" }

[project.optional-dependencies]
config = ["tomlkit", "typeguard<3.0.0"]
test = ["mock", "pytest-html", "pytest-socket", "ansi2html", "httpretty"]

[project.urls]
repository = "https://github.com/AdaCore/e3-core"

[tools.setuptools.packages.find]
namespace = true
where = ["src"]

[tools.setuptools.package-data]
e3 = ["py.typed"]
"e3.os.data" = ["rlimit-*"]

[project.entry-points."e3.anod.sandbox.sandbox_action"]
exec = "e3.anod.sandbox.action:SandBoxExec"
create = "e3.anod.sandbox.action:SandBoxCreate"
show-config = "e3.anod.sandbox.action:SandBoxShowConfiguration"
migrate = "e3.anod.sandbox.migrate:SandBoxMigrate"

[project.entry-points."e3.event.handler"]
smtp = "e3.event.handler.smtp:SMTPHandler"
logging = "e3.event.handler.logging:LoggingHandler"
file = "e3.event.handler.file:FileHandler"
s3 = "e3.event.handler.s3:S3Handler"

[project.entry-points."e3.store"]
http-simple-store = "e3.store.backends.http_simple_store:HTTPSimpleStore"

[project.entry-points."e3.store.cache.backend"]
file-cache = "e3.store.cache.backends.filecache:FileCache"

[project.entry-points.sandbox_scripts]
anod = "e3.anod.sandbox.scripts:anod"

[project.entry-points.console_scripts]
e3 = "e3.sys:main"
e3-sandbox = "e3.anod.sandbox.main:main"
e3-pypi-closure = "e3.python.pypiscript:main"
89 changes: 0 additions & 89 deletions setup.py

This file was deleted.

3 changes: 0 additions & 3 deletions src/e3/__init__.py

This file was deleted.

29 changes: 27 additions & 2 deletions src/e3/os/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,34 @@ def get_rlimit(platform: str | None = None) -> str:
if platform == "x86_64-windows64":
platform = "x86_64-windows"

from pkg_resources import resource_filename
from atexit import register
from contextlib import ExitStack

# try:
# from importlib.resources import files, as_file
# except ImportError: # For compatibily with older version
from importlib_resources import files, as_file # type: ignore[no-redef]

file_manager = ExitStack()
register(file_manager.close)
rlimit_path = str(
file_manager.enter_context(
as_file(files("e3.os") / "data" / f"rlimit-{platform}")
)
)
old_path = os.environ.get("PATH", "")
if old_path:
os.environ["PATH"] = "{}:{}".format(os.path.dirname(rlimit_path), old_path)
else:
os.environ["PATH"] = os.path.dirname(rlimit_path)

print(os.path.dirname(rlimit_path))
print(os.environ["PATH"])
from shutil import which as shutil_which

return resource_filename(__name__, os.path.join("data", f"rlimit-{platform}"))
print("shutil.which = {}".format(shutil_which(f"rlimit-{platform}")))
print("e3.os.fs.which = {}".format(which(f"rlimit-{platform}")))
return rlimit_path


def quote_arg(arg: str) -> str:
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[tox]
envlist = py39-cov-xdist
isolated_build = True

[testenv]
deps =
importlib-resources
xdist: pytest-xdist[psutil]
# ??? needs to be added as a dep of e3-core
requests-cache
Expand Down
Loading