Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include SConstruct
include SConscript
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think we need these two?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't, removing

recursive-include board *
recursive-include crypto *
recursive-include certs *
recursive-include tests *
5 changes: 5 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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__)), "../")
)
Empty file added py.typed
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this? we should only add top level files/dirs if absolutely needed

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

py.typed is required by [PEP 561] without it, type checkers like mypy treat everything as Any.

Empty file.
21 changes: 19 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ dependencies = [
[project.optional-dependencies]
dev = [
"scons",
"pycryptodome >= 3.9.8",
"cffi",
"flaky",
"pytest",
Expand All @@ -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",]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no way to use the dependencies declared above?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried, based on my reading [project].dependencies includes deps that are required after the build whereas [build-system].requires includes deps required before the build, and as per my knowledge there is no place where we can mention deps that are common to both of these environments...these are treated as two completely different enviroments.

build-backend = "setuptools.build_meta"

[tool.setuptools]
Expand All @@ -43,6 +42,24 @@ packages = ["panda"]
[tool.setuptools.package-dir]
panda = "."

[tool.hatch.build.targets.wheel]
packages = ["src/panda"]
include = [ "include/**"
]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleanup the formatting


[tool.hatch.build.targets.wheel.shared-data]
"include" = "include"

[tool.setuptools.package-data]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this redundant with MANIFEST.in?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

panda = [
"board/**/*.h",
"board/**/*.py",
"board/obj/**/*.bin",
"board/obj/**/*.elf",
"board/obj/**/*.bin.signed",
"python/**/*.py"
]

[tool.mypy]
# third-party packages
ignore_missing_imports = true
Expand Down
30 changes: 30 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import os
import subprocess
from setuptools import setup, find_packages
from setuptools.command.build import build as _build

class build(_build):
def run(self):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong indentation

env = os.environ.copy()
env['FINAL_PROVISIONING'] = '1'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not be set

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, removed


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,
)
Loading