1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Merge pull request #2207 from GNS3/pyproject-migration

Support for pyproject.toml
This commit is contained in:
Jeremy Grossmann 2023-03-21 18:00:13 +08:00 committed by GitHub
commit 66157a335d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 69 deletions

View File

@ -34,4 +34,4 @@ COPY . /gns3server
RUN mkdir -p ~/.config/GNS3/3.0/
RUN cp scripts/gns3_server.conf ~/.config/GNS3/3.0/
RUN python3 setup.py install
RUN python3 -m pip install .

58
pyproject.toml Normal file
View File

@ -0,0 +1,58 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "gns3-server"
description = "GNS3 graphical interface for the GNS3 server."
license = {file = "LICENSE"}
authors = [
{ name="Jeremy Grossmann" }
]
readme = "README.md"
requires-python = ">=3.7"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Framework :: FastAPI",
"Intended Audience :: Information Technology",
"Topic :: System :: Networking",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Natural Language :: English",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython"
]
dynamic = ["version", "dependencies"]
[tool.setuptools]
packages = ["gns3server"]
[tool.setuptools.dynamic]
version = {attr = "gns3server.version.__version__"}
dependencies = {file = "requirements.txt"}
[project.optional-dependencies]
test = [
"pytest==7.2.2",
"flake8==5.0.4", # v5.0.4 is the last to support Python 3.7
"pytest-timeout==2.1.0",
"pytest-asyncio==0.20.3",
"requests==2.28.2",
"httpx==0.23.3"
]
[project.urls]
"Homepage" = "http://gns3.com"
"Repository" = "http://github.com/GNS3/gns3-server"
"Bug tracker" = "http://github.com/GNS3/gns3-server/issues"
[project.scripts]
gns3server = "gns3server.main:main"
gns3vmnet = "gns3server.utils.vmnet:main"

View File

@ -20,28 +20,7 @@ import os
import shutil
import subprocess
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
# we only support Python 3 version >= 3.7
if len(sys.argv) >= 2 and sys.argv[1] == "install" and sys.version_info < (3, 7, 0):
raise SystemExit("Python 3.7 or higher is required")
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
# import here, cause outside the eggs aren't loaded
import pytest
errcode = pytest.main(self.test_args)
sys.exit(errcode)
from setuptools import setup
BUSYBOX_PATH = "gns3server/compute/docker/resources/bin/busybox"
@ -64,49 +43,5 @@ def copy_busybox():
raise SystemExit("No static busybox found")
copy_busybox()
dependencies = open("requirements.txt", "r").read().splitlines()
setup(
name="gns3-server",
version=__import__("gns3server").__version__,
url="http://github.com/GNS3/gns3-server",
license="GNU General Public License v3 (GPLv3)",
cmdclass={"test": PyTest},
description="GNS3 server",
long_description=open("README.md", "r").read(),
long_description_content_type="text/markdown",
install_requires=dependencies,
entry_points={
"console_scripts": [
"gns3server = gns3server.main:main",
"gns3vmnet = gns3server.utils.vmnet:main"
]
},
packages=find_packages(".", exclude=["docs", "tests*"]),
include_package_data=True,
zip_safe=False,
platforms="any",
python_requires='>=3.7.0',
setup_requires=["setuptools>=17.1"],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Information Technology",
"Topic :: System :: Networking",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Natural Language :: English",
"Operating System :: POSIX",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
],
)
copy_busybox() # TODO: this should probably be done when the first time the server is started
setup() # required with setuptools below version 64.0.0