diff --git a/__init__.py b/__init__.py index 12fbe3a7c5..dfa21883e7 100644 --- a/__init__.py +++ b/__init__.py @@ -1,3 +1,4 @@ +import os from .python.constants import McuType, BASEDIR, FW_PATH, USBPACKET_MAX_SIZE # noqa: F401 from .python.spi import PandaSpiException, PandaProtocolMismatch, STBootloaderSPIHandle # noqa: F401 from .python.serial import PandaSerial # noqa: F401 @@ -8,3 +9,7 @@ # panda jungle from .board.jungle import PandaJungle, PandaJungleDFU # noqa: F401 + +INCLUDE_PATH = os.path.abspath( + os.path.join(os.path.dirname(os.path.realpath(__file__)), "../") +) \ No newline at end of file diff --git a/py.typed b/py.typed new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pyproject.toml b/pyproject.toml index 660fc3e63e..1ae5df8b24 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,6 @@ dependencies = [ [project.optional-dependencies] dev = [ "scons", - "pycryptodome >= 3.9.8", "cffi", "flaky", "pytest", @@ -34,7 +33,7 @@ dev = [ ] [build-system] -requires = ["setuptools>=61", "wheel"] +requires = ["setuptools>=61", "wheel", "pycryptodome >= 3.9.8", "scons", "opendbc @ git+https://github.com/commaai/opendbc.git@master#egg=opendbc"] build-backend = "setuptools.build_meta" [tool.setuptools] @@ -43,6 +42,19 @@ packages = ["panda"] [tool.setuptools.package-dir] panda = "." +[tool.hatch.build.targets.wheel] +packages = ["src/panda"] +include = ["include/**"] + +[tool.hatch.build.targets.wheel.shared-data] +"include" = "include" + +[tool.setuptools.package-data] +panda = [ + "board/**", + "python/**", +] + [tool.mypy] # third-party packages ignore_missing_imports = true diff --git a/setup.py b/setup.py new file mode 100644 index 0000000000..90af8de6a4 --- /dev/null +++ b/setup.py @@ -0,0 +1,27 @@ +import os +import subprocess +from setuptools import setup, find_packages +from setuptools.command.build import build as _build + + +class build(_build): + def run(self): + env = os.environ.copy() + + project_root = os.path.abspath(os.path.dirname(__file__)) + + print("Building firmware with scons...") + + subprocess.check_call(["scons", "-j4"], cwd=project_root, env=env) + + super().run() + + +setup( + name="pandacan", + version="0.0.10", + packages=find_packages(), + cmdclass={"build": build}, + package_data={"panda": ["py.typed"]}, + zip_safe=False, +)