mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
GitOrigin-RevId: ac60fd3cf4a24023184376687da28373d14b781a This mirrors the robotpy files for the following projects: - apriltag - datalog - hal - ntcore - romiVendordep - wpilibc - wpimath - xrpVendordep This excludes cscore and the halsim wrappers for at this time. NOTE: This does not hook these projects up to the build system, just simply mirrors the files. The building will take place in a follow up PR to make it easier to review the changes necessary to build.
34 lines
795 B
Python
34 lines
795 B
Python
from ._wpilib import RobotBase
|
|
import json
|
|
import typing
|
|
|
|
|
|
def getDeployData() -> typing.Optional[typing.Dict[str, str]]:
|
|
"""
|
|
Utility function useful for retrieving deploy-related information
|
|
that pyfrc stores with your robot code. The dictionary has the
|
|
following keys:
|
|
|
|
* deploy-host
|
|
* deploy-user
|
|
* deploy-date
|
|
* code-path
|
|
|
|
If the code is deployed from a git repo, and the git program is in
|
|
your path, the following keys will also be present:
|
|
|
|
* git-hash
|
|
* git-desc
|
|
* git-branch
|
|
|
|
:returns: None in simulation, or a dictionary
|
|
"""
|
|
if not RobotBase.isReal():
|
|
return None
|
|
|
|
try:
|
|
with open("/home/systemcore/py/deploy.json") as fp:
|
|
return json.load(fp)
|
|
except FileNotFoundError:
|
|
return {}
|