mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[robotpy] Mirror most other subprojects (#8208)
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.
This commit is contained in:
33
wpilibc/src/main/python/wpilib/deployinfo.py
Normal file
33
wpilibc/src/main/python/wpilib/deployinfo.py
Normal file
@@ -0,0 +1,33 @@
|
||||
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 {}
|
||||
Reference in New Issue
Block a user