Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +82 -0
- CAD/R20/mask_0.png +3 -0
- CAD/R20/mask_14.png +3 -0
- CAD/R20/mask_41.png +3 -0
- CAD/R20/mask_6.png +3 -0
- CAD/R20/mask_8.png +3 -0
- CAD/R20/model_0.png +3 -0
- CAD/R20/rgb_12.png +3 -0
- CAD/R20/rgb_18.png +3 -0
- CAD/R20/rgb_19.png +3 -0
- CAD/R20/rgb_25.png +3 -0
- CAD/R20/rgb_29.png +3 -0
- CAD/R20/rgb_5.png +3 -0
- CAD/R20/rgb_9.png +3 -0
- CAD/R20/xyz_19.npy +3 -0
- CAD/R20/xyz_27.npy +3 -0
- CAD/R20/xyz_29.npy +3 -0
- CAD/R20/xyz_31.npy +3 -0
- CAD/R20/xyz_36.npy +3 -0
- CAD/R20/xyz_39.npy +3 -0
- CAD/R20/xyz_4.npy +3 -0
- CAD/R20/xyz_41.npy +3 -0
- CAD/R274/mask_14.png +3 -0
- CAD/R274/mask_30.png +3 -0
- CAD/R274/rgb_16.png +3 -0
- CAD/R274/rgb_33.png +3 -0
- CAD/R274/xyz_10.npy +3 -0
- CAD/R274/xyz_21.npy +3 -0
- CAD/R274/xyz_35.npy +3 -0
- project/ManiSkill3/src/maniskill2_benchmark/mani_skill2_repo/.eggs/setuptools-80.9.0-py3.10.egg/setuptools/_distutils/_msvccompiler.py +16 -0
- project/ManiSkill3/src/maniskill2_benchmark/mani_skill2_repo/.eggs/setuptools-80.9.0-py3.10.egg/setuptools/_distutils/core.py +289 -0
- project/ManiSkill3/src/maniskill2_benchmark/mani_skill2_repo/.eggs/setuptools-80.9.0-py3.10.egg/setuptools/_distutils/dist.py +1386 -0
- project/ManiSkill3/src/maniskill2_benchmark/mani_skill2_repo/.eggs/setuptools-80.9.0-py3.10.egg/setuptools/_distutils/fancy_getopt.py +471 -0
- project/ManiSkill3/src/maniskill2_benchmark/mani_skill2_repo/.eggs/setuptools-80.9.0-py3.10.egg/setuptools/_distutils/unixccompiler.py +9 -0
- project/ManiSkill3/src/maniskill2_benchmark/msx_envs/msx_envs/legacy/ms2/scene_generator_env.py +583 -0
- project/ManiSkill3/src/maniskill3_environment/docs/source/_static/env_thumbnails/PickClutterYCB-v1_rt_thumb_first.png +3 -0
- project/ManiSkill3/src/maniskill3_environment/docs/source/_static/env_thumbnails/PickClutterYCB-v1_rt_thumb_last.png +3 -0
- project/ManiSkill3/src/maniskill3_environment/docs/source/_static/env_thumbnails/PickSingleYCB-v1_rt_thumb_last.png +3 -0
- project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/AnymalC-Reach-v1_rt.mp4 +3 -0
- project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/AnymalC-Spin-v1_rt.mp4 +3 -0
- project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/AssemblingKits-v1_rt.mp4 +3 -0
- project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/FMBAssembly1Easy.mp4 +3 -0
- project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/LiftPegUpright-v1_rt.mp4 +3 -0
- project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/MS-CartpoleBalance-v1_rt.mp4 +3 -0
- project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/ManiSkill-HAB_rt.mp4 +3 -0
- project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/OpenCabinetDrawer-v1_rt.mp4 +3 -0
- project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/PegInsertionSide-v1_rt.mp4 +3 -0
- project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/PickClutterYCB-v1_rt.mp4 +3 -0
- project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/PickCube-v1_rt.mp4 +3 -0
- project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/PickSingleYCB-v1_rt.mp4 +3 -0
.gitattributes
CHANGED
|
@@ -229,3 +229,85 @@ maniskill3_environment_assets/robots/dclaw/meshes/visual/link_2.glb filter=lfs d
|
|
| 229 |
maniskill3_environment_assets/robots/dclaw/meshes/visual/base_link.glb filter=lfs diff=lfs merge=lfs -text
|
| 230 |
maniskill3_environment_assets/environment_maps/default.hdr filter=lfs diff=lfs merge=lfs -text
|
| 231 |
project/ManiSkill3/src/maniskill2_benchmark/cfdp_experiment/cfdp/extern/pytorch3d/pytorch3d/_C.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
maniskill3_environment_assets/robots/dclaw/meshes/visual/base_link.glb filter=lfs diff=lfs merge=lfs -text
|
| 230 |
maniskill3_environment_assets/environment_maps/default.hdr filter=lfs diff=lfs merge=lfs -text
|
| 231 |
project/ManiSkill3/src/maniskill2_benchmark/cfdp_experiment/cfdp/extern/pytorch3d/pytorch3d/_C.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 232 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/maniskill2-scene-2.glb filter=lfs diff=lfs merge=lfs -text
|
| 233 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/panda/sciurus17_description/meshes/collision/Base.stl filter=lfs diff=lfs merge=lfs -text
|
| 234 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/panda/sciurus17_description/meshes/collision/Body.stl filter=lfs diff=lfs merge=lfs -text
|
| 235 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/panda/sciurus17_description/meshes/visual/Base.stl filter=lfs diff=lfs merge=lfs -text
|
| 236 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/panda/realsense2_description/meshes/plug.stl filter=lfs diff=lfs merge=lfs -text
|
| 237 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/panda/sciurus17_description/meshes/visual/Body.stl filter=lfs diff=lfs merge=lfs -text
|
| 238 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/panda/realsense2_description/meshes/d435.dae filter=lfs diff=lfs merge=lfs -text
|
| 239 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/panda/franka_description/meshes/visual/link4.glb filter=lfs diff=lfs merge=lfs -text
|
| 240 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/ability_hand/meshes/visual/FB_palm_ref.glb filter=lfs diff=lfs merge=lfs -text
|
| 241 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/allegro/meshes/visual/base_link_left.glb filter=lfs diff=lfs merge=lfs -text
|
| 242 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/ability_hand/meshes/visual/FB_palm_ref_MIR.glb filter=lfs diff=lfs merge=lfs -text
|
| 243 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/ability_hand/meshes/visual/wristmesh.glb filter=lfs diff=lfs merge=lfs -text
|
| 244 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/allegro/meshes/visual/link_12.0_right.glb filter=lfs diff=lfs merge=lfs -text
|
| 245 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/allegro/meshes/visual/link_12.0_left.glb filter=lfs diff=lfs merge=lfs -text
|
| 246 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/coffee_machine/coffee_machine.glb filter=lfs diff=lfs merge=lfs -text
|
| 247 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/racks/dish_rack.stl filter=lfs diff=lfs merge=lfs -text
|
| 248 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/environment_maps/default.hdr filter=lfs diff=lfs merge=lfs -text
|
| 249 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/fetch/fetch_description/meshes/estop_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 250 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/fetch/fetch_description/meshes/r_wheel_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 251 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/fetch/fetch_description/meshes/head_pan_link_collision.STL filter=lfs diff=lfs merge=lfs -text
|
| 252 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/right_palm_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 253 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/left_five_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 254 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/right_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 255 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/left_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 256 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/right_six_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 257 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/left_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 258 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/right_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 259 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/right_elbow_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 260 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/left_shoulder_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 261 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/left_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 262 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/right_ankle_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 263 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/right_one_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 264 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/left_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 265 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/head_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 266 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/left_four_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 267 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/right_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 268 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/torso_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 269 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/pelvis.STL filter=lfs diff=lfs merge=lfs -text
|
| 270 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/left_one_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 271 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/right_four_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 272 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/right_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 273 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/left_elbow_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 274 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/edu/lower_link.stl filter=lfs diff=lfs merge=lfs -text
|
| 275 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/edu/middle_link.stl filter=lfs diff=lfs merge=lfs -text
|
| 276 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/pro/int_sim.stl filter=lfs diff=lfs merge=lfs -text
|
| 277 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/pro/detailed/SIM__BL-Finger_Tip.stl filter=lfs diff=lfs merge=lfs -text
|
| 278 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/pro/detailed/SIM__BL-Finger_Proximal.stl filter=lfs diff=lfs merge=lfs -text
|
| 279 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/pro/prox-sim.stl filter=lfs diff=lfs merge=lfs -text
|
| 280 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/edu/upper_link.stl filter=lfs diff=lfs merge=lfs -text
|
| 281 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/pro/detailed/SIM__BL-Finger_Tip_without_tip.stl filter=lfs diff=lfs merge=lfs -text
|
| 282 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/pro/center_axis_sim.stl filter=lfs diff=lfs merge=lfs -text
|
| 283 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/pro/detailed/SIM__BL-Finger_Intermediate.stl filter=lfs diff=lfs merge=lfs -text
|
| 284 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/pro/detailed/SIM__BL-Finger_Base.stl filter=lfs diff=lfs merge=lfs -text
|
| 285 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/allegro/meshes/visual/base_link.glb filter=lfs diff=lfs merge=lfs -text
|
| 286 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/high_table_boundary.stl filter=lfs diff=lfs merge=lfs -text
|
| 287 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/SIM_BL_FINGER_TIP_LINK.stl filter=lfs diff=lfs merge=lfs -text
|
| 288 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/finger_padding.stl filter=lfs diff=lfs merge=lfs -text
|
| 289 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/BL-M_Table_ASM_small.stl filter=lfs diff=lfs merge=lfs -text
|
| 290 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/BL-M_Table_ASM_big.stl filter=lfs diff=lfs merge=lfs -text
|
| 291 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/SIM__BL-Finger_Base.stl filter=lfs diff=lfs merge=lfs -text
|
| 292 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/SIM__BL-Finger_Proximal.stl filter=lfs diff=lfs merge=lfs -text
|
| 293 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/object_containment_sim.stl filter=lfs diff=lfs merge=lfs -text
|
| 294 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/trifinger/robot_properties_fingers/meshes/SIM__BL-Finger_Intermediate.stl filter=lfs diff=lfs merge=lfs -text
|
| 295 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/panda/franka_description/meshes/visual/hand.glb filter=lfs diff=lfs merge=lfs -text
|
| 296 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/dclaw/meshes/visual/link_3.glb filter=lfs diff=lfs merge=lfs -text
|
| 297 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/panda/realsense2_description/meshes/d415.stl filter=lfs diff=lfs merge=lfs -text
|
| 298 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/panda/franka_description/meshes/visual/link0.glb filter=lfs diff=lfs merge=lfs -text
|
| 299 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/panda/franka_description/meshes/visual/link1.glb filter=lfs diff=lfs merge=lfs -text
|
| 300 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/panda/franka_description/meshes/visual/link2.glb filter=lfs diff=lfs merge=lfs -text
|
| 301 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/panda/franka_description/meshes/visual/link5.glb filter=lfs diff=lfs merge=lfs -text
|
| 302 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/panda/franka_description/meshes/visual/link6.glb filter=lfs diff=lfs merge=lfs -text
|
| 303 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/panda/franka_description/meshes/visual/link7.glb filter=lfs diff=lfs merge=lfs -text
|
| 304 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/panda/franka_description/meshes/visual/link3.glb filter=lfs diff=lfs merge=lfs -text
|
| 305 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/pelvis_contour_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 306 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/g1_humanoid/meshes/left_three_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 307 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/xarm7/meshes/visual/link1.glb filter=lfs diff=lfs merge=lfs -text
|
| 308 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/xarm7/meshes/visual/link7.glb filter=lfs diff=lfs merge=lfs -text
|
| 309 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/dclaw/meshes/visual/link_1.glb filter=lfs diff=lfs merge=lfs -text
|
| 310 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/dclaw/meshes/visual/base_link.glb filter=lfs diff=lfs merge=lfs -text
|
| 311 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/dclaw/meshes/visual/link_2.glb filter=lfs diff=lfs merge=lfs -text
|
| 312 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/xarm7/meshes/visual/link_base.glb filter=lfs diff=lfs merge=lfs -text
|
| 313 |
+
project/ManiSkill3/src/maniskill3_environment/mani_skill/assets/robots/xarm7/meshes/visual/link3.glb filter=lfs diff=lfs merge=lfs -text
|
CAD/R20/mask_0.png
ADDED
|
Git LFS Details
|
CAD/R20/mask_14.png
ADDED
|
Git LFS Details
|
CAD/R20/mask_41.png
ADDED
|
Git LFS Details
|
CAD/R20/mask_6.png
ADDED
|
Git LFS Details
|
CAD/R20/mask_8.png
ADDED
|
Git LFS Details
|
CAD/R20/model_0.png
ADDED
|
Git LFS Details
|
CAD/R20/rgb_12.png
ADDED
|
Git LFS Details
|
CAD/R20/rgb_18.png
ADDED
|
Git LFS Details
|
CAD/R20/rgb_19.png
ADDED
|
Git LFS Details
|
CAD/R20/rgb_25.png
ADDED
|
Git LFS Details
|
CAD/R20/rgb_29.png
ADDED
|
Git LFS Details
|
CAD/R20/rgb_5.png
ADDED
|
Git LFS Details
|
CAD/R20/rgb_9.png
ADDED
|
Git LFS Details
|
CAD/R20/xyz_19.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1b52775b1821c7f34dae249d5d217a809339b258ccc7fc3688bd8a877db75e19
|
| 3 |
+
size 1572992
|
CAD/R20/xyz_27.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9dac0c440b3e3d43f9e956fbdc6dca77eddbf803ef1b2c380133def5e829cdde
|
| 3 |
+
size 1572992
|
CAD/R20/xyz_29.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a1441b52de2fd80d9443c6411ba0bf5a756a273dfa938abad70fbf212bffe0ac
|
| 3 |
+
size 1572992
|
CAD/R20/xyz_31.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3df33f983413a0360d806325b4553891ff22201d7e1ec803e4f262b9681f7284
|
| 3 |
+
size 1572992
|
CAD/R20/xyz_36.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a8023ea9f9e95abfa9312578092ccac4539ca38eee42e3b4cc682d0bc93841c8
|
| 3 |
+
size 1572992
|
CAD/R20/xyz_39.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:26d9648c8d1827c405d9fda895a529302befa1ea11114e94dcc3a3d5dd242824
|
| 3 |
+
size 1572992
|
CAD/R20/xyz_4.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1607101c37f4aefef3d28c7ea2584d8630a8d7dc04cd840b80a7db5b59738ad9
|
| 3 |
+
size 1572992
|
CAD/R20/xyz_41.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:044bcee56a1cb96ccb2840bb62959a0a0a23f8d61cfe5498f5e24e75b749e9ad
|
| 3 |
+
size 1572992
|
CAD/R274/mask_14.png
ADDED
|
Git LFS Details
|
CAD/R274/mask_30.png
ADDED
|
Git LFS Details
|
CAD/R274/rgb_16.png
ADDED
|
Git LFS Details
|
CAD/R274/rgb_33.png
ADDED
|
Git LFS Details
|
CAD/R274/xyz_10.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ce76f5b1ab3c7296bb72875646e2bc1ae83a94c4fdf68fe1730e8c43e6214231
|
| 3 |
+
size 1572992
|
CAD/R274/xyz_21.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ec726442fb13131e7a36c0865c91eaa17b418562ad19cca02f03dac45c1b71bd
|
| 3 |
+
size 1572992
|
CAD/R274/xyz_35.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:80b5bd3dcfb9a54b4361c53648f26a367eb60b42cff49c58045fe8008493e6ec
|
| 3 |
+
size 1572992
|
project/ManiSkill3/src/maniskill2_benchmark/mani_skill2_repo/.eggs/setuptools-80.9.0-py3.10.egg/setuptools/_distutils/_msvccompiler.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import warnings
|
| 2 |
+
|
| 3 |
+
from .compilers.C import msvc
|
| 4 |
+
|
| 5 |
+
__all__ = ["MSVCCompiler"]
|
| 6 |
+
|
| 7 |
+
MSVCCompiler = msvc.Compiler
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def __getattr__(name):
|
| 11 |
+
if name == '_get_vc_env':
|
| 12 |
+
warnings.warn(
|
| 13 |
+
"_get_vc_env is private; find an alternative (pypa/distutils#340)"
|
| 14 |
+
)
|
| 15 |
+
return msvc._get_vc_env
|
| 16 |
+
raise AttributeError(name)
|
project/ManiSkill3/src/maniskill2_benchmark/mani_skill2_repo/.eggs/setuptools-80.9.0-py3.10.egg/setuptools/_distutils/core.py
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""distutils.core
|
| 2 |
+
|
| 3 |
+
The only module that needs to be imported to use the Distutils; provides
|
| 4 |
+
the 'setup' function (which is to be called from the setup script). Also
|
| 5 |
+
indirectly provides the Distribution and Command classes, although they are
|
| 6 |
+
really defined in distutils.dist and distutils.cmd.
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
from __future__ import annotations
|
| 10 |
+
|
| 11 |
+
import os
|
| 12 |
+
import sys
|
| 13 |
+
import tokenize
|
| 14 |
+
from collections.abc import Iterable
|
| 15 |
+
|
| 16 |
+
from .cmd import Command
|
| 17 |
+
from .debug import DEBUG
|
| 18 |
+
|
| 19 |
+
# Mainly import these so setup scripts can "from distutils.core import" them.
|
| 20 |
+
from .dist import Distribution
|
| 21 |
+
from .errors import (
|
| 22 |
+
CCompilerError,
|
| 23 |
+
DistutilsArgError,
|
| 24 |
+
DistutilsError,
|
| 25 |
+
DistutilsSetupError,
|
| 26 |
+
)
|
| 27 |
+
from .extension import Extension
|
| 28 |
+
|
| 29 |
+
__all__ = ['Distribution', 'Command', 'Extension', 'setup']
|
| 30 |
+
|
| 31 |
+
# This is a barebones help message generated displayed when the user
|
| 32 |
+
# runs the setup script with no arguments at all. More useful help
|
| 33 |
+
# is generated with various --help options: global help, list commands,
|
| 34 |
+
# and per-command help.
|
| 35 |
+
USAGE = """\
|
| 36 |
+
usage: %(script)s [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
|
| 37 |
+
or: %(script)s --help [cmd1 cmd2 ...]
|
| 38 |
+
or: %(script)s --help-commands
|
| 39 |
+
or: %(script)s cmd --help
|
| 40 |
+
"""
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def gen_usage(script_name):
|
| 44 |
+
script = os.path.basename(script_name)
|
| 45 |
+
return USAGE % locals()
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
# Some mild magic to control the behaviour of 'setup()' from 'run_setup()'.
|
| 49 |
+
_setup_stop_after = None
|
| 50 |
+
_setup_distribution = None
|
| 51 |
+
|
| 52 |
+
# Legal keyword arguments for the setup() function
|
| 53 |
+
setup_keywords = (
|
| 54 |
+
'distclass',
|
| 55 |
+
'script_name',
|
| 56 |
+
'script_args',
|
| 57 |
+
'options',
|
| 58 |
+
'name',
|
| 59 |
+
'version',
|
| 60 |
+
'author',
|
| 61 |
+
'author_email',
|
| 62 |
+
'maintainer',
|
| 63 |
+
'maintainer_email',
|
| 64 |
+
'url',
|
| 65 |
+
'license',
|
| 66 |
+
'description',
|
| 67 |
+
'long_description',
|
| 68 |
+
'keywords',
|
| 69 |
+
'platforms',
|
| 70 |
+
'classifiers',
|
| 71 |
+
'download_url',
|
| 72 |
+
'requires',
|
| 73 |
+
'provides',
|
| 74 |
+
'obsoletes',
|
| 75 |
+
)
|
| 76 |
+
|
| 77 |
+
# Legal keyword arguments for the Extension constructor
|
| 78 |
+
extension_keywords = (
|
| 79 |
+
'name',
|
| 80 |
+
'sources',
|
| 81 |
+
'include_dirs',
|
| 82 |
+
'define_macros',
|
| 83 |
+
'undef_macros',
|
| 84 |
+
'library_dirs',
|
| 85 |
+
'libraries',
|
| 86 |
+
'runtime_library_dirs',
|
| 87 |
+
'extra_objects',
|
| 88 |
+
'extra_compile_args',
|
| 89 |
+
'extra_link_args',
|
| 90 |
+
'swig_opts',
|
| 91 |
+
'export_symbols',
|
| 92 |
+
'depends',
|
| 93 |
+
'language',
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
def setup(**attrs): # noqa: C901
|
| 98 |
+
"""The gateway to the Distutils: do everything your setup script needs
|
| 99 |
+
to do, in a highly flexible and user-driven way. Briefly: create a
|
| 100 |
+
Distribution instance; find and parse config files; parse the command
|
| 101 |
+
line; run each Distutils command found there, customized by the options
|
| 102 |
+
supplied to 'setup()' (as keyword arguments), in config files, and on
|
| 103 |
+
the command line.
|
| 104 |
+
|
| 105 |
+
The Distribution instance might be an instance of a class supplied via
|
| 106 |
+
the 'distclass' keyword argument to 'setup'; if no such class is
|
| 107 |
+
supplied, then the Distribution class (in dist.py) is instantiated.
|
| 108 |
+
All other arguments to 'setup' (except for 'cmdclass') are used to set
|
| 109 |
+
attributes of the Distribution instance.
|
| 110 |
+
|
| 111 |
+
The 'cmdclass' argument, if supplied, is a dictionary mapping command
|
| 112 |
+
names to command classes. Each command encountered on the command line
|
| 113 |
+
will be turned into a command class, which is in turn instantiated; any
|
| 114 |
+
class found in 'cmdclass' is used in place of the default, which is
|
| 115 |
+
(for command 'foo_bar') class 'foo_bar' in module
|
| 116 |
+
'distutils.command.foo_bar'. The command class must provide a
|
| 117 |
+
'user_options' attribute which is a list of option specifiers for
|
| 118 |
+
'distutils.fancy_getopt'. Any command-line options between the current
|
| 119 |
+
and the next command are used to set attributes of the current command
|
| 120 |
+
object.
|
| 121 |
+
|
| 122 |
+
When the entire command-line has been successfully parsed, calls the
|
| 123 |
+
'run()' method on each command object in turn. This method will be
|
| 124 |
+
driven entirely by the Distribution object (which each command object
|
| 125 |
+
has a reference to, thanks to its constructor), and the
|
| 126 |
+
command-specific options that became attributes of each command
|
| 127 |
+
object.
|
| 128 |
+
"""
|
| 129 |
+
|
| 130 |
+
global _setup_stop_after, _setup_distribution
|
| 131 |
+
|
| 132 |
+
# Determine the distribution class -- either caller-supplied or
|
| 133 |
+
# our Distribution (see below).
|
| 134 |
+
klass = attrs.get('distclass')
|
| 135 |
+
if klass:
|
| 136 |
+
attrs.pop('distclass')
|
| 137 |
+
else:
|
| 138 |
+
klass = Distribution
|
| 139 |
+
|
| 140 |
+
if 'script_name' not in attrs:
|
| 141 |
+
attrs['script_name'] = os.path.basename(sys.argv[0])
|
| 142 |
+
if 'script_args' not in attrs:
|
| 143 |
+
attrs['script_args'] = sys.argv[1:]
|
| 144 |
+
|
| 145 |
+
# Create the Distribution instance, using the remaining arguments
|
| 146 |
+
# (ie. everything except distclass) to initialize it
|
| 147 |
+
try:
|
| 148 |
+
_setup_distribution = dist = klass(attrs)
|
| 149 |
+
except DistutilsSetupError as msg:
|
| 150 |
+
if 'name' not in attrs:
|
| 151 |
+
raise SystemExit(f"error in setup command: {msg}")
|
| 152 |
+
else:
|
| 153 |
+
raise SystemExit("error in {} setup command: {}".format(attrs['name'], msg))
|
| 154 |
+
|
| 155 |
+
if _setup_stop_after == "init":
|
| 156 |
+
return dist
|
| 157 |
+
|
| 158 |
+
# Find and parse the config file(s): they will override options from
|
| 159 |
+
# the setup script, but be overridden by the command line.
|
| 160 |
+
dist.parse_config_files()
|
| 161 |
+
|
| 162 |
+
if DEBUG:
|
| 163 |
+
print("options (after parsing config files):")
|
| 164 |
+
dist.dump_option_dicts()
|
| 165 |
+
|
| 166 |
+
if _setup_stop_after == "config":
|
| 167 |
+
return dist
|
| 168 |
+
|
| 169 |
+
# Parse the command line and override config files; any
|
| 170 |
+
# command-line errors are the end user's fault, so turn them into
|
| 171 |
+
# SystemExit to suppress tracebacks.
|
| 172 |
+
try:
|
| 173 |
+
ok = dist.parse_command_line()
|
| 174 |
+
except DistutilsArgError as msg:
|
| 175 |
+
raise SystemExit(gen_usage(dist.script_name) + f"\nerror: {msg}")
|
| 176 |
+
|
| 177 |
+
if DEBUG:
|
| 178 |
+
print("options (after parsing command line):")
|
| 179 |
+
dist.dump_option_dicts()
|
| 180 |
+
|
| 181 |
+
if _setup_stop_after == "commandline":
|
| 182 |
+
return dist
|
| 183 |
+
|
| 184 |
+
# And finally, run all the commands found on the command line.
|
| 185 |
+
if ok:
|
| 186 |
+
return run_commands(dist)
|
| 187 |
+
|
| 188 |
+
return dist
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
# setup ()
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
def run_commands(dist):
|
| 195 |
+
"""Given a Distribution object run all the commands,
|
| 196 |
+
raising ``SystemExit`` errors in the case of failure.
|
| 197 |
+
|
| 198 |
+
This function assumes that either ``sys.argv`` or ``dist.script_args``
|
| 199 |
+
is already set accordingly.
|
| 200 |
+
"""
|
| 201 |
+
try:
|
| 202 |
+
dist.run_commands()
|
| 203 |
+
except KeyboardInterrupt:
|
| 204 |
+
raise SystemExit("interrupted")
|
| 205 |
+
except OSError as exc:
|
| 206 |
+
if DEBUG:
|
| 207 |
+
sys.stderr.write(f"error: {exc}\n")
|
| 208 |
+
raise
|
| 209 |
+
else:
|
| 210 |
+
raise SystemExit(f"error: {exc}")
|
| 211 |
+
|
| 212 |
+
except (DistutilsError, CCompilerError) as msg:
|
| 213 |
+
if DEBUG:
|
| 214 |
+
raise
|
| 215 |
+
else:
|
| 216 |
+
raise SystemExit("error: " + str(msg))
|
| 217 |
+
|
| 218 |
+
return dist
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
def run_setup(script_name, script_args: Iterable[str] | None = None, stop_after="run"):
|
| 222 |
+
"""Run a setup script in a somewhat controlled environment, and
|
| 223 |
+
return the Distribution instance that drives things. This is useful
|
| 224 |
+
if you need to find out the distribution meta-data (passed as
|
| 225 |
+
keyword args from 'script' to 'setup()', or the contents of the
|
| 226 |
+
config files or command-line.
|
| 227 |
+
|
| 228 |
+
'script_name' is a file that will be read and run with 'exec()';
|
| 229 |
+
'sys.argv[0]' will be replaced with 'script' for the duration of the
|
| 230 |
+
call. 'script_args' is a list of strings; if supplied,
|
| 231 |
+
'sys.argv[1:]' will be replaced by 'script_args' for the duration of
|
| 232 |
+
the call.
|
| 233 |
+
|
| 234 |
+
'stop_after' tells 'setup()' when to stop processing; possible
|
| 235 |
+
values:
|
| 236 |
+
init
|
| 237 |
+
stop after the Distribution instance has been created and
|
| 238 |
+
populated with the keyword arguments to 'setup()'
|
| 239 |
+
config
|
| 240 |
+
stop after config files have been parsed (and their data
|
| 241 |
+
stored in the Distribution instance)
|
| 242 |
+
commandline
|
| 243 |
+
stop after the command-line ('sys.argv[1:]' or 'script_args')
|
| 244 |
+
have been parsed (and the data stored in the Distribution)
|
| 245 |
+
run [default]
|
| 246 |
+
stop after all commands have been run (the same as if 'setup()'
|
| 247 |
+
had been called in the usual way
|
| 248 |
+
|
| 249 |
+
Returns the Distribution instance, which provides all information
|
| 250 |
+
used to drive the Distutils.
|
| 251 |
+
"""
|
| 252 |
+
if stop_after not in ('init', 'config', 'commandline', 'run'):
|
| 253 |
+
raise ValueError(f"invalid value for 'stop_after': {stop_after!r}")
|
| 254 |
+
|
| 255 |
+
global _setup_stop_after, _setup_distribution
|
| 256 |
+
_setup_stop_after = stop_after
|
| 257 |
+
|
| 258 |
+
save_argv = sys.argv.copy()
|
| 259 |
+
g = {'__file__': script_name, '__name__': '__main__'}
|
| 260 |
+
try:
|
| 261 |
+
try:
|
| 262 |
+
sys.argv[0] = script_name
|
| 263 |
+
if script_args is not None:
|
| 264 |
+
sys.argv[1:] = script_args
|
| 265 |
+
# tokenize.open supports automatic encoding detection
|
| 266 |
+
with tokenize.open(script_name) as f:
|
| 267 |
+
code = f.read().replace(r'\r\n', r'\n')
|
| 268 |
+
exec(code, g)
|
| 269 |
+
finally:
|
| 270 |
+
sys.argv = save_argv
|
| 271 |
+
_setup_stop_after = None
|
| 272 |
+
except SystemExit:
|
| 273 |
+
# Hmm, should we do something if exiting with a non-zero code
|
| 274 |
+
# (ie. error)?
|
| 275 |
+
pass
|
| 276 |
+
|
| 277 |
+
if _setup_distribution is None:
|
| 278 |
+
raise RuntimeError(
|
| 279 |
+
"'distutils.core.setup()' was never called -- "
|
| 280 |
+
f"perhaps '{script_name}' is not a Distutils setup script?"
|
| 281 |
+
)
|
| 282 |
+
|
| 283 |
+
# I wonder if the setup script's namespace -- g and l -- would be of
|
| 284 |
+
# any interest to callers?
|
| 285 |
+
# print "_setup_distribution:", _setup_distribution
|
| 286 |
+
return _setup_distribution
|
| 287 |
+
|
| 288 |
+
|
| 289 |
+
# run_setup ()
|
project/ManiSkill3/src/maniskill2_benchmark/mani_skill2_repo/.eggs/setuptools-80.9.0-py3.10.egg/setuptools/_distutils/dist.py
ADDED
|
@@ -0,0 +1,1386 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""distutils.dist
|
| 2 |
+
|
| 3 |
+
Provides the Distribution class, which represents the module distribution
|
| 4 |
+
being built/installed/distributed.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from __future__ import annotations
|
| 8 |
+
|
| 9 |
+
import contextlib
|
| 10 |
+
import logging
|
| 11 |
+
import os
|
| 12 |
+
import pathlib
|
| 13 |
+
import re
|
| 14 |
+
import sys
|
| 15 |
+
import warnings
|
| 16 |
+
from collections.abc import Iterable, MutableMapping
|
| 17 |
+
from email import message_from_file
|
| 18 |
+
from typing import (
|
| 19 |
+
IO,
|
| 20 |
+
TYPE_CHECKING,
|
| 21 |
+
Any,
|
| 22 |
+
ClassVar,
|
| 23 |
+
Literal,
|
| 24 |
+
TypeVar,
|
| 25 |
+
Union,
|
| 26 |
+
overload,
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
from packaging.utils import canonicalize_name, canonicalize_version
|
| 30 |
+
|
| 31 |
+
from ._log import log
|
| 32 |
+
from .debug import DEBUG
|
| 33 |
+
from .errors import (
|
| 34 |
+
DistutilsArgError,
|
| 35 |
+
DistutilsClassError,
|
| 36 |
+
DistutilsModuleError,
|
| 37 |
+
DistutilsOptionError,
|
| 38 |
+
)
|
| 39 |
+
from .fancy_getopt import FancyGetopt, translate_longopt
|
| 40 |
+
from .util import check_environ, rfc822_escape, strtobool
|
| 41 |
+
|
| 42 |
+
if TYPE_CHECKING:
|
| 43 |
+
from _typeshed import SupportsWrite
|
| 44 |
+
from typing_extensions import TypeAlias
|
| 45 |
+
|
| 46 |
+
# type-only import because of mutual dependence between these modules
|
| 47 |
+
from .cmd import Command
|
| 48 |
+
|
| 49 |
+
_CommandT = TypeVar("_CommandT", bound="Command")
|
| 50 |
+
_OptionsList: TypeAlias = list[
|
| 51 |
+
Union[tuple[str, Union[str, None], str, int], tuple[str, Union[str, None], str]]
|
| 52 |
+
]
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
# Regex to define acceptable Distutils command names. This is not *quite*
|
| 56 |
+
# the same as a Python NAME -- I don't allow leading underscores. The fact
|
| 57 |
+
# that they're very similar is no coincidence; the default naming scheme is
|
| 58 |
+
# to look for a Python module named after the command.
|
| 59 |
+
command_re = re.compile(r'^[a-zA-Z]([a-zA-Z0-9_]*)$')
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
def _ensure_list(value: str | Iterable[str], fieldname) -> str | list[str]:
|
| 63 |
+
if isinstance(value, str):
|
| 64 |
+
# a string containing comma separated values is okay. It will
|
| 65 |
+
# be converted to a list by Distribution.finalize_options().
|
| 66 |
+
pass
|
| 67 |
+
elif not isinstance(value, list):
|
| 68 |
+
# passing a tuple or an iterator perhaps, warn and convert
|
| 69 |
+
typename = type(value).__name__
|
| 70 |
+
msg = "Warning: '{fieldname}' should be a list, got type '{typename}'"
|
| 71 |
+
msg = msg.format(**locals())
|
| 72 |
+
log.warning(msg)
|
| 73 |
+
value = list(value)
|
| 74 |
+
return value
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
class Distribution:
|
| 78 |
+
"""The core of the Distutils. Most of the work hiding behind 'setup'
|
| 79 |
+
is really done within a Distribution instance, which farms the work out
|
| 80 |
+
to the Distutils commands specified on the command line.
|
| 81 |
+
|
| 82 |
+
Setup scripts will almost never instantiate Distribution directly,
|
| 83 |
+
unless the 'setup()' function is totally inadequate to their needs.
|
| 84 |
+
However, it is conceivable that a setup script might wish to subclass
|
| 85 |
+
Distribution for some specialized purpose, and then pass the subclass
|
| 86 |
+
to 'setup()' as the 'distclass' keyword argument. If so, it is
|
| 87 |
+
necessary to respect the expectations that 'setup' has of Distribution.
|
| 88 |
+
See the code for 'setup()', in core.py, for details.
|
| 89 |
+
"""
|
| 90 |
+
|
| 91 |
+
# 'global_options' describes the command-line options that may be
|
| 92 |
+
# supplied to the setup script prior to any actual commands.
|
| 93 |
+
# Eg. "./setup.py -n" or "./setup.py --quiet" both take advantage of
|
| 94 |
+
# these global options. This list should be kept to a bare minimum,
|
| 95 |
+
# since every global option is also valid as a command option -- and we
|
| 96 |
+
# don't want to pollute the commands with too many options that they
|
| 97 |
+
# have minimal control over.
|
| 98 |
+
# The fourth entry for verbose means that it can be repeated.
|
| 99 |
+
global_options: ClassVar[_OptionsList] = [
|
| 100 |
+
('verbose', 'v', "run verbosely (default)", 1),
|
| 101 |
+
('quiet', 'q', "run quietly (turns verbosity off)"),
|
| 102 |
+
('dry-run', 'n', "don't actually do anything"),
|
| 103 |
+
('help', 'h', "show detailed help message"),
|
| 104 |
+
('no-user-cfg', None, 'ignore pydistutils.cfg in your home directory'),
|
| 105 |
+
]
|
| 106 |
+
|
| 107 |
+
# 'common_usage' is a short (2-3 line) string describing the common
|
| 108 |
+
# usage of the setup script.
|
| 109 |
+
common_usage: ClassVar[str] = """\
|
| 110 |
+
Common commands: (see '--help-commands' for more)
|
| 111 |
+
|
| 112 |
+
setup.py build will build the package underneath 'build/'
|
| 113 |
+
setup.py install will install the package
|
| 114 |
+
"""
|
| 115 |
+
|
| 116 |
+
# options that are not propagated to the commands
|
| 117 |
+
display_options: ClassVar[_OptionsList] = [
|
| 118 |
+
('help-commands', None, "list all available commands"),
|
| 119 |
+
('name', None, "print package name"),
|
| 120 |
+
('version', 'V', "print package version"),
|
| 121 |
+
('fullname', None, "print <package name>-<version>"),
|
| 122 |
+
('author', None, "print the author's name"),
|
| 123 |
+
('author-email', None, "print the author's email address"),
|
| 124 |
+
('maintainer', None, "print the maintainer's name"),
|
| 125 |
+
('maintainer-email', None, "print the maintainer's email address"),
|
| 126 |
+
('contact', None, "print the maintainer's name if known, else the author's"),
|
| 127 |
+
(
|
| 128 |
+
'contact-email',
|
| 129 |
+
None,
|
| 130 |
+
"print the maintainer's email address if known, else the author's",
|
| 131 |
+
),
|
| 132 |
+
('url', None, "print the URL for this package"),
|
| 133 |
+
('license', None, "print the license of the package"),
|
| 134 |
+
('licence', None, "alias for --license"),
|
| 135 |
+
('description', None, "print the package description"),
|
| 136 |
+
('long-description', None, "print the long package description"),
|
| 137 |
+
('platforms', None, "print the list of platforms"),
|
| 138 |
+
('classifiers', None, "print the list of classifiers"),
|
| 139 |
+
('keywords', None, "print the list of keywords"),
|
| 140 |
+
('provides', None, "print the list of packages/modules provided"),
|
| 141 |
+
('requires', None, "print the list of packages/modules required"),
|
| 142 |
+
('obsoletes', None, "print the list of packages/modules made obsolete"),
|
| 143 |
+
]
|
| 144 |
+
display_option_names: ClassVar[list[str]] = [
|
| 145 |
+
translate_longopt(x[0]) for x in display_options
|
| 146 |
+
]
|
| 147 |
+
|
| 148 |
+
# negative options are options that exclude other options
|
| 149 |
+
negative_opt: ClassVar[dict[str, str]] = {'quiet': 'verbose'}
|
| 150 |
+
|
| 151 |
+
# -- Creation/initialization methods -------------------------------
|
| 152 |
+
|
| 153 |
+
# Can't Unpack a TypedDict with optional properties, so using Any instead
|
| 154 |
+
def __init__(self, attrs: MutableMapping[str, Any] | None = None) -> None: # noqa: C901
|
| 155 |
+
"""Construct a new Distribution instance: initialize all the
|
| 156 |
+
attributes of a Distribution, and then use 'attrs' (a dictionary
|
| 157 |
+
mapping attribute names to values) to assign some of those
|
| 158 |
+
attributes their "real" values. (Any attributes not mentioned in
|
| 159 |
+
'attrs' will be assigned to some null value: 0, None, an empty list
|
| 160 |
+
or dictionary, etc.) Most importantly, initialize the
|
| 161 |
+
'command_obj' attribute to the empty dictionary; this will be
|
| 162 |
+
filled in with real command objects by 'parse_command_line()'.
|
| 163 |
+
"""
|
| 164 |
+
|
| 165 |
+
# Default values for our command-line options
|
| 166 |
+
self.verbose = True
|
| 167 |
+
self.dry_run = False
|
| 168 |
+
self.help = False
|
| 169 |
+
for attr in self.display_option_names:
|
| 170 |
+
setattr(self, attr, False)
|
| 171 |
+
|
| 172 |
+
# Store the distribution meta-data (name, version, author, and so
|
| 173 |
+
# forth) in a separate object -- we're getting to have enough
|
| 174 |
+
# information here (and enough command-line options) that it's
|
| 175 |
+
# worth it. Also delegate 'get_XXX()' methods to the 'metadata'
|
| 176 |
+
# object in a sneaky and underhanded (but efficient!) way.
|
| 177 |
+
self.metadata = DistributionMetadata()
|
| 178 |
+
for basename in self.metadata._METHOD_BASENAMES:
|
| 179 |
+
method_name = "get_" + basename
|
| 180 |
+
setattr(self, method_name, getattr(self.metadata, method_name))
|
| 181 |
+
|
| 182 |
+
# 'cmdclass' maps command names to class objects, so we
|
| 183 |
+
# can 1) quickly figure out which class to instantiate when
|
| 184 |
+
# we need to create a new command object, and 2) have a way
|
| 185 |
+
# for the setup script to override command classes
|
| 186 |
+
self.cmdclass: dict[str, type[Command]] = {}
|
| 187 |
+
|
| 188 |
+
# 'command_packages' is a list of packages in which commands
|
| 189 |
+
# are searched for. The factory for command 'foo' is expected
|
| 190 |
+
# to be named 'foo' in the module 'foo' in one of the packages
|
| 191 |
+
# named here. This list is searched from the left; an error
|
| 192 |
+
# is raised if no named package provides the command being
|
| 193 |
+
# searched for. (Always access using get_command_packages().)
|
| 194 |
+
self.command_packages: str | list[str] | None = None
|
| 195 |
+
|
| 196 |
+
# 'script_name' and 'script_args' are usually set to sys.argv[0]
|
| 197 |
+
# and sys.argv[1:], but they can be overridden when the caller is
|
| 198 |
+
# not necessarily a setup script run from the command-line.
|
| 199 |
+
self.script_name: str | os.PathLike[str] | None = None
|
| 200 |
+
self.script_args: list[str] | None = None
|
| 201 |
+
|
| 202 |
+
# 'command_options' is where we store command options between
|
| 203 |
+
# parsing them (from config files, the command-line, etc.) and when
|
| 204 |
+
# they are actually needed -- ie. when the command in question is
|
| 205 |
+
# instantiated. It is a dictionary of dictionaries of 2-tuples:
|
| 206 |
+
# command_options = { command_name : { option : (source, value) } }
|
| 207 |
+
self.command_options: dict[str, dict[str, tuple[str, str]]] = {}
|
| 208 |
+
|
| 209 |
+
# 'dist_files' is the list of (command, pyversion, file) that
|
| 210 |
+
# have been created by any dist commands run so far. This is
|
| 211 |
+
# filled regardless of whether the run is dry or not. pyversion
|
| 212 |
+
# gives sysconfig.get_python_version() if the dist file is
|
| 213 |
+
# specific to a Python version, 'any' if it is good for all
|
| 214 |
+
# Python versions on the target platform, and '' for a source
|
| 215 |
+
# file. pyversion should not be used to specify minimum or
|
| 216 |
+
# maximum required Python versions; use the metainfo for that
|
| 217 |
+
# instead.
|
| 218 |
+
self.dist_files: list[tuple[str, str, str]] = []
|
| 219 |
+
|
| 220 |
+
# These options are really the business of various commands, rather
|
| 221 |
+
# than of the Distribution itself. We provide aliases for them in
|
| 222 |
+
# Distribution as a convenience to the developer.
|
| 223 |
+
self.packages = None
|
| 224 |
+
self.package_data: dict[str, list[str]] = {}
|
| 225 |
+
self.package_dir = None
|
| 226 |
+
self.py_modules = None
|
| 227 |
+
self.libraries = None
|
| 228 |
+
self.headers = None
|
| 229 |
+
self.ext_modules = None
|
| 230 |
+
self.ext_package = None
|
| 231 |
+
self.include_dirs = None
|
| 232 |
+
self.extra_path = None
|
| 233 |
+
self.scripts = None
|
| 234 |
+
self.data_files = None
|
| 235 |
+
self.password = ''
|
| 236 |
+
|
| 237 |
+
# And now initialize bookkeeping stuff that can't be supplied by
|
| 238 |
+
# the caller at all. 'command_obj' maps command names to
|
| 239 |
+
# Command instances -- that's how we enforce that every command
|
| 240 |
+
# class is a singleton.
|
| 241 |
+
self.command_obj: dict[str, Command] = {}
|
| 242 |
+
|
| 243 |
+
# 'have_run' maps command names to boolean values; it keeps track
|
| 244 |
+
# of whether we have actually run a particular command, to make it
|
| 245 |
+
# cheap to "run" a command whenever we think we might need to -- if
|
| 246 |
+
# it's already been done, no need for expensive filesystem
|
| 247 |
+
# operations, we just check the 'have_run' dictionary and carry on.
|
| 248 |
+
# It's only safe to query 'have_run' for a command class that has
|
| 249 |
+
# been instantiated -- a false value will be inserted when the
|
| 250 |
+
# command object is created, and replaced with a true value when
|
| 251 |
+
# the command is successfully run. Thus it's probably best to use
|
| 252 |
+
# '.get()' rather than a straight lookup.
|
| 253 |
+
self.have_run: dict[str, bool] = {}
|
| 254 |
+
|
| 255 |
+
# Now we'll use the attrs dictionary (ultimately, keyword args from
|
| 256 |
+
# the setup script) to possibly override any or all of these
|
| 257 |
+
# distribution options.
|
| 258 |
+
|
| 259 |
+
if attrs:
|
| 260 |
+
# Pull out the set of command options and work on them
|
| 261 |
+
# specifically. Note that this order guarantees that aliased
|
| 262 |
+
# command options will override any supplied redundantly
|
| 263 |
+
# through the general options dictionary.
|
| 264 |
+
options = attrs.get('options')
|
| 265 |
+
if options is not None:
|
| 266 |
+
del attrs['options']
|
| 267 |
+
for command, cmd_options in options.items():
|
| 268 |
+
opt_dict = self.get_option_dict(command)
|
| 269 |
+
for opt, val in cmd_options.items():
|
| 270 |
+
opt_dict[opt] = ("setup script", val)
|
| 271 |
+
|
| 272 |
+
if 'licence' in attrs:
|
| 273 |
+
attrs['license'] = attrs['licence']
|
| 274 |
+
del attrs['licence']
|
| 275 |
+
msg = "'licence' distribution option is deprecated; use 'license'"
|
| 276 |
+
warnings.warn(msg)
|
| 277 |
+
|
| 278 |
+
# Now work on the rest of the attributes. Any attribute that's
|
| 279 |
+
# not already defined is invalid!
|
| 280 |
+
for key, val in attrs.items():
|
| 281 |
+
if hasattr(self.metadata, "set_" + key):
|
| 282 |
+
getattr(self.metadata, "set_" + key)(val)
|
| 283 |
+
elif hasattr(self.metadata, key):
|
| 284 |
+
setattr(self.metadata, key, val)
|
| 285 |
+
elif hasattr(self, key):
|
| 286 |
+
setattr(self, key, val)
|
| 287 |
+
else:
|
| 288 |
+
msg = f"Unknown distribution option: {key!r}"
|
| 289 |
+
warnings.warn(msg)
|
| 290 |
+
|
| 291 |
+
# no-user-cfg is handled before other command line args
|
| 292 |
+
# because other args override the config files, and this
|
| 293 |
+
# one is needed before we can load the config files.
|
| 294 |
+
# If attrs['script_args'] wasn't passed, assume false.
|
| 295 |
+
#
|
| 296 |
+
# This also make sure we just look at the global options
|
| 297 |
+
self.want_user_cfg = True
|
| 298 |
+
|
| 299 |
+
if self.script_args is not None:
|
| 300 |
+
# Coerce any possible iterable from attrs into a list
|
| 301 |
+
self.script_args = list(self.script_args)
|
| 302 |
+
for arg in self.script_args:
|
| 303 |
+
if not arg.startswith('-'):
|
| 304 |
+
break
|
| 305 |
+
if arg == '--no-user-cfg':
|
| 306 |
+
self.want_user_cfg = False
|
| 307 |
+
break
|
| 308 |
+
|
| 309 |
+
self.finalize_options()
|
| 310 |
+
|
| 311 |
+
def get_option_dict(self, command):
|
| 312 |
+
"""Get the option dictionary for a given command. If that
|
| 313 |
+
command's option dictionary hasn't been created yet, then create it
|
| 314 |
+
and return the new dictionary; otherwise, return the existing
|
| 315 |
+
option dictionary.
|
| 316 |
+
"""
|
| 317 |
+
dict = self.command_options.get(command)
|
| 318 |
+
if dict is None:
|
| 319 |
+
dict = self.command_options[command] = {}
|
| 320 |
+
return dict
|
| 321 |
+
|
| 322 |
+
def dump_option_dicts(self, header=None, commands=None, indent: str = "") -> None:
|
| 323 |
+
from pprint import pformat
|
| 324 |
+
|
| 325 |
+
if commands is None: # dump all command option dicts
|
| 326 |
+
commands = sorted(self.command_options.keys())
|
| 327 |
+
|
| 328 |
+
if header is not None:
|
| 329 |
+
self.announce(indent + header)
|
| 330 |
+
indent = indent + " "
|
| 331 |
+
|
| 332 |
+
if not commands:
|
| 333 |
+
self.announce(indent + "no commands known yet")
|
| 334 |
+
return
|
| 335 |
+
|
| 336 |
+
for cmd_name in commands:
|
| 337 |
+
opt_dict = self.command_options.get(cmd_name)
|
| 338 |
+
if opt_dict is None:
|
| 339 |
+
self.announce(indent + f"no option dict for '{cmd_name}' command")
|
| 340 |
+
else:
|
| 341 |
+
self.announce(indent + f"option dict for '{cmd_name}' command:")
|
| 342 |
+
out = pformat(opt_dict)
|
| 343 |
+
for line in out.split('\n'):
|
| 344 |
+
self.announce(indent + " " + line)
|
| 345 |
+
|
| 346 |
+
# -- Config file finding/parsing methods ---------------------------
|
| 347 |
+
|
| 348 |
+
def find_config_files(self):
|
| 349 |
+
"""Find as many configuration files as should be processed for this
|
| 350 |
+
platform, and return a list of filenames in the order in which they
|
| 351 |
+
should be parsed. The filenames returned are guaranteed to exist
|
| 352 |
+
(modulo nasty race conditions).
|
| 353 |
+
|
| 354 |
+
There are multiple possible config files:
|
| 355 |
+
- distutils.cfg in the Distutils installation directory (i.e.
|
| 356 |
+
where the top-level Distutils __inst__.py file lives)
|
| 357 |
+
- a file in the user's home directory named .pydistutils.cfg
|
| 358 |
+
on Unix and pydistutils.cfg on Windows/Mac; may be disabled
|
| 359 |
+
with the ``--no-user-cfg`` option
|
| 360 |
+
- setup.cfg in the current directory
|
| 361 |
+
- a file named by an environment variable
|
| 362 |
+
"""
|
| 363 |
+
check_environ()
|
| 364 |
+
files = [str(path) for path in self._gen_paths() if os.path.isfile(path)]
|
| 365 |
+
|
| 366 |
+
if DEBUG:
|
| 367 |
+
self.announce("using config files: {}".format(', '.join(files)))
|
| 368 |
+
|
| 369 |
+
return files
|
| 370 |
+
|
| 371 |
+
def _gen_paths(self):
|
| 372 |
+
# The system-wide Distutils config file
|
| 373 |
+
sys_dir = pathlib.Path(sys.modules['distutils'].__file__).parent
|
| 374 |
+
yield sys_dir / "distutils.cfg"
|
| 375 |
+
|
| 376 |
+
# The per-user config file
|
| 377 |
+
prefix = '.' * (os.name == 'posix')
|
| 378 |
+
filename = prefix + 'pydistutils.cfg'
|
| 379 |
+
if self.want_user_cfg:
|
| 380 |
+
with contextlib.suppress(RuntimeError):
|
| 381 |
+
yield pathlib.Path('~').expanduser() / filename
|
| 382 |
+
|
| 383 |
+
# All platforms support local setup.cfg
|
| 384 |
+
yield pathlib.Path('setup.cfg')
|
| 385 |
+
|
| 386 |
+
# Additional config indicated in the environment
|
| 387 |
+
with contextlib.suppress(TypeError):
|
| 388 |
+
yield pathlib.Path(os.getenv("DIST_EXTRA_CONFIG"))
|
| 389 |
+
|
| 390 |
+
def parse_config_files(self, filenames=None): # noqa: C901
|
| 391 |
+
from configparser import ConfigParser
|
| 392 |
+
|
| 393 |
+
# Ignore install directory options if we have a venv
|
| 394 |
+
if sys.prefix != sys.base_prefix:
|
| 395 |
+
ignore_options = [
|
| 396 |
+
'install-base',
|
| 397 |
+
'install-platbase',
|
| 398 |
+
'install-lib',
|
| 399 |
+
'install-platlib',
|
| 400 |
+
'install-purelib',
|
| 401 |
+
'install-headers',
|
| 402 |
+
'install-scripts',
|
| 403 |
+
'install-data',
|
| 404 |
+
'prefix',
|
| 405 |
+
'exec-prefix',
|
| 406 |
+
'home',
|
| 407 |
+
'user',
|
| 408 |
+
'root',
|
| 409 |
+
]
|
| 410 |
+
else:
|
| 411 |
+
ignore_options = []
|
| 412 |
+
|
| 413 |
+
ignore_options = frozenset(ignore_options)
|
| 414 |
+
|
| 415 |
+
if filenames is None:
|
| 416 |
+
filenames = self.find_config_files()
|
| 417 |
+
|
| 418 |
+
if DEBUG:
|
| 419 |
+
self.announce("Distribution.parse_config_files():")
|
| 420 |
+
|
| 421 |
+
parser = ConfigParser()
|
| 422 |
+
for filename in filenames:
|
| 423 |
+
if DEBUG:
|
| 424 |
+
self.announce(f" reading {filename}")
|
| 425 |
+
parser.read(filename, encoding='utf-8')
|
| 426 |
+
for section in parser.sections():
|
| 427 |
+
options = parser.options(section)
|
| 428 |
+
opt_dict = self.get_option_dict(section)
|
| 429 |
+
|
| 430 |
+
for opt in options:
|
| 431 |
+
if opt != '__name__' and opt not in ignore_options:
|
| 432 |
+
val = parser.get(section, opt)
|
| 433 |
+
opt = opt.replace('-', '_')
|
| 434 |
+
opt_dict[opt] = (filename, val)
|
| 435 |
+
|
| 436 |
+
# Make the ConfigParser forget everything (so we retain
|
| 437 |
+
# the original filenames that options come from)
|
| 438 |
+
parser.__init__()
|
| 439 |
+
|
| 440 |
+
# If there was a "global" section in the config file, use it
|
| 441 |
+
# to set Distribution options.
|
| 442 |
+
|
| 443 |
+
if 'global' in self.command_options:
|
| 444 |
+
for opt, (_src, val) in self.command_options['global'].items():
|
| 445 |
+
alias = self.negative_opt.get(opt)
|
| 446 |
+
try:
|
| 447 |
+
if alias:
|
| 448 |
+
setattr(self, alias, not strtobool(val))
|
| 449 |
+
elif opt in ('verbose', 'dry_run'): # ugh!
|
| 450 |
+
setattr(self, opt, strtobool(val))
|
| 451 |
+
else:
|
| 452 |
+
setattr(self, opt, val)
|
| 453 |
+
except ValueError as msg:
|
| 454 |
+
raise DistutilsOptionError(msg)
|
| 455 |
+
|
| 456 |
+
# -- Command-line parsing methods ----------------------------------
|
| 457 |
+
|
| 458 |
+
def parse_command_line(self):
|
| 459 |
+
"""Parse the setup script's command line, taken from the
|
| 460 |
+
'script_args' instance attribute (which defaults to 'sys.argv[1:]'
|
| 461 |
+
-- see 'setup()' in core.py). This list is first processed for
|
| 462 |
+
"global options" -- options that set attributes of the Distribution
|
| 463 |
+
instance. Then, it is alternately scanned for Distutils commands
|
| 464 |
+
and options for that command. Each new command terminates the
|
| 465 |
+
options for the previous command. The allowed options for a
|
| 466 |
+
command are determined by the 'user_options' attribute of the
|
| 467 |
+
command class -- thus, we have to be able to load command classes
|
| 468 |
+
in order to parse the command line. Any error in that 'options'
|
| 469 |
+
attribute raises DistutilsGetoptError; any error on the
|
| 470 |
+
command-line raises DistutilsArgError. If no Distutils commands
|
| 471 |
+
were found on the command line, raises DistutilsArgError. Return
|
| 472 |
+
true if command-line was successfully parsed and we should carry
|
| 473 |
+
on with executing commands; false if no errors but we shouldn't
|
| 474 |
+
execute commands (currently, this only happens if user asks for
|
| 475 |
+
help).
|
| 476 |
+
"""
|
| 477 |
+
#
|
| 478 |
+
# We now have enough information to show the Macintosh dialog
|
| 479 |
+
# that allows the user to interactively specify the "command line".
|
| 480 |
+
#
|
| 481 |
+
toplevel_options = self._get_toplevel_options()
|
| 482 |
+
|
| 483 |
+
# We have to parse the command line a bit at a time -- global
|
| 484 |
+
# options, then the first command, then its options, and so on --
|
| 485 |
+
# because each command will be handled by a different class, and
|
| 486 |
+
# the options that are valid for a particular class aren't known
|
| 487 |
+
# until we have loaded the command class, which doesn't happen
|
| 488 |
+
# until we know what the command is.
|
| 489 |
+
|
| 490 |
+
self.commands = []
|
| 491 |
+
parser = FancyGetopt(toplevel_options + self.display_options)
|
| 492 |
+
parser.set_negative_aliases(self.negative_opt)
|
| 493 |
+
parser.set_aliases({'licence': 'license'})
|
| 494 |
+
args = parser.getopt(args=self.script_args, object=self)
|
| 495 |
+
option_order = parser.get_option_order()
|
| 496 |
+
logging.getLogger().setLevel(logging.WARN - 10 * self.verbose)
|
| 497 |
+
|
| 498 |
+
# for display options we return immediately
|
| 499 |
+
if self.handle_display_options(option_order):
|
| 500 |
+
return
|
| 501 |
+
while args:
|
| 502 |
+
args = self._parse_command_opts(parser, args)
|
| 503 |
+
if args is None: # user asked for help (and got it)
|
| 504 |
+
return
|
| 505 |
+
|
| 506 |
+
# Handle the cases of --help as a "global" option, ie.
|
| 507 |
+
# "setup.py --help" and "setup.py --help command ...". For the
|
| 508 |
+
# former, we show global options (--verbose, --dry-run, etc.)
|
| 509 |
+
# and display-only options (--name, --version, etc.); for the
|
| 510 |
+
# latter, we omit the display-only options and show help for
|
| 511 |
+
# each command listed on the command line.
|
| 512 |
+
if self.help:
|
| 513 |
+
self._show_help(
|
| 514 |
+
parser, display_options=len(self.commands) == 0, commands=self.commands
|
| 515 |
+
)
|
| 516 |
+
return
|
| 517 |
+
|
| 518 |
+
# Oops, no commands found -- an end-user error
|
| 519 |
+
if not self.commands:
|
| 520 |
+
raise DistutilsArgError("no commands supplied")
|
| 521 |
+
|
| 522 |
+
# All is well: return true
|
| 523 |
+
return True
|
| 524 |
+
|
| 525 |
+
def _get_toplevel_options(self):
|
| 526 |
+
"""Return the non-display options recognized at the top level.
|
| 527 |
+
|
| 528 |
+
This includes options that are recognized *only* at the top
|
| 529 |
+
level as well as options recognized for commands.
|
| 530 |
+
"""
|
| 531 |
+
return self.global_options + [
|
| 532 |
+
(
|
| 533 |
+
"command-packages=",
|
| 534 |
+
None,
|
| 535 |
+
"list of packages that provide distutils commands",
|
| 536 |
+
),
|
| 537 |
+
]
|
| 538 |
+
|
| 539 |
+
def _parse_command_opts(self, parser, args): # noqa: C901
|
| 540 |
+
"""Parse the command-line options for a single command.
|
| 541 |
+
'parser' must be a FancyGetopt instance; 'args' must be the list
|
| 542 |
+
of arguments, starting with the current command (whose options
|
| 543 |
+
we are about to parse). Returns a new version of 'args' with
|
| 544 |
+
the next command at the front of the list; will be the empty
|
| 545 |
+
list if there are no more commands on the command line. Returns
|
| 546 |
+
None if the user asked for help on this command.
|
| 547 |
+
"""
|
| 548 |
+
# late import because of mutual dependence between these modules
|
| 549 |
+
from distutils.cmd import Command
|
| 550 |
+
|
| 551 |
+
# Pull the current command from the head of the command line
|
| 552 |
+
command = args[0]
|
| 553 |
+
if not command_re.match(command):
|
| 554 |
+
raise SystemExit(f"invalid command name '{command}'")
|
| 555 |
+
self.commands.append(command)
|
| 556 |
+
|
| 557 |
+
# Dig up the command class that implements this command, so we
|
| 558 |
+
# 1) know that it's a valid command, and 2) know which options
|
| 559 |
+
# it takes.
|
| 560 |
+
try:
|
| 561 |
+
cmd_class = self.get_command_class(command)
|
| 562 |
+
except DistutilsModuleError as msg:
|
| 563 |
+
raise DistutilsArgError(msg)
|
| 564 |
+
|
| 565 |
+
# Require that the command class be derived from Command -- want
|
| 566 |
+
# to be sure that the basic "command" interface is implemented.
|
| 567 |
+
if not issubclass(cmd_class, Command):
|
| 568 |
+
raise DistutilsClassError(
|
| 569 |
+
f"command class {cmd_class} must subclass Command"
|
| 570 |
+
)
|
| 571 |
+
|
| 572 |
+
# Also make sure that the command object provides a list of its
|
| 573 |
+
# known options.
|
| 574 |
+
if not (
|
| 575 |
+
hasattr(cmd_class, 'user_options')
|
| 576 |
+
and isinstance(cmd_class.user_options, list)
|
| 577 |
+
):
|
| 578 |
+
msg = (
|
| 579 |
+
"command class %s must provide "
|
| 580 |
+
"'user_options' attribute (a list of tuples)"
|
| 581 |
+
)
|
| 582 |
+
raise DistutilsClassError(msg % cmd_class)
|
| 583 |
+
|
| 584 |
+
# If the command class has a list of negative alias options,
|
| 585 |
+
# merge it in with the global negative aliases.
|
| 586 |
+
negative_opt = self.negative_opt
|
| 587 |
+
if hasattr(cmd_class, 'negative_opt'):
|
| 588 |
+
negative_opt = negative_opt.copy()
|
| 589 |
+
negative_opt.update(cmd_class.negative_opt)
|
| 590 |
+
|
| 591 |
+
# Check for help_options in command class. They have a different
|
| 592 |
+
# format (tuple of four) so we need to preprocess them here.
|
| 593 |
+
if hasattr(cmd_class, 'help_options') and isinstance(
|
| 594 |
+
cmd_class.help_options, list
|
| 595 |
+
):
|
| 596 |
+
help_options = fix_help_options(cmd_class.help_options)
|
| 597 |
+
else:
|
| 598 |
+
help_options = []
|
| 599 |
+
|
| 600 |
+
# All commands support the global options too, just by adding
|
| 601 |
+
# in 'global_options'.
|
| 602 |
+
parser.set_option_table(
|
| 603 |
+
self.global_options + cmd_class.user_options + help_options
|
| 604 |
+
)
|
| 605 |
+
parser.set_negative_aliases(negative_opt)
|
| 606 |
+
(args, opts) = parser.getopt(args[1:])
|
| 607 |
+
if hasattr(opts, 'help') and opts.help:
|
| 608 |
+
self._show_help(parser, display_options=False, commands=[cmd_class])
|
| 609 |
+
return
|
| 610 |
+
|
| 611 |
+
if hasattr(cmd_class, 'help_options') and isinstance(
|
| 612 |
+
cmd_class.help_options, list
|
| 613 |
+
):
|
| 614 |
+
help_option_found = 0
|
| 615 |
+
for help_option, _short, _desc, func in cmd_class.help_options:
|
| 616 |
+
if hasattr(opts, parser.get_attr_name(help_option)):
|
| 617 |
+
help_option_found = 1
|
| 618 |
+
if callable(func):
|
| 619 |
+
func()
|
| 620 |
+
else:
|
| 621 |
+
raise DistutilsClassError(
|
| 622 |
+
f"invalid help function {func!r} for help option '{help_option}': "
|
| 623 |
+
"must be a callable object (function, etc.)"
|
| 624 |
+
)
|
| 625 |
+
|
| 626 |
+
if help_option_found:
|
| 627 |
+
return
|
| 628 |
+
|
| 629 |
+
# Put the options from the command-line into their official
|
| 630 |
+
# holding pen, the 'command_options' dictionary.
|
| 631 |
+
opt_dict = self.get_option_dict(command)
|
| 632 |
+
for name, value in vars(opts).items():
|
| 633 |
+
opt_dict[name] = ("command line", value)
|
| 634 |
+
|
| 635 |
+
return args
|
| 636 |
+
|
| 637 |
+
def finalize_options(self) -> None:
|
| 638 |
+
"""Set final values for all the options on the Distribution
|
| 639 |
+
instance, analogous to the .finalize_options() method of Command
|
| 640 |
+
objects.
|
| 641 |
+
"""
|
| 642 |
+
for attr in ('keywords', 'platforms'):
|
| 643 |
+
value = getattr(self.metadata, attr)
|
| 644 |
+
if value is None:
|
| 645 |
+
continue
|
| 646 |
+
if isinstance(value, str):
|
| 647 |
+
value = [elm.strip() for elm in value.split(',')]
|
| 648 |
+
setattr(self.metadata, attr, value)
|
| 649 |
+
|
| 650 |
+
def _show_help(
|
| 651 |
+
self, parser, global_options=True, display_options=True, commands: Iterable = ()
|
| 652 |
+
):
|
| 653 |
+
"""Show help for the setup script command-line in the form of
|
| 654 |
+
several lists of command-line options. 'parser' should be a
|
| 655 |
+
FancyGetopt instance; do not expect it to be returned in the
|
| 656 |
+
same state, as its option table will be reset to make it
|
| 657 |
+
generate the correct help text.
|
| 658 |
+
|
| 659 |
+
If 'global_options' is true, lists the global options:
|
| 660 |
+
--verbose, --dry-run, etc. If 'display_options' is true, lists
|
| 661 |
+
the "display-only" options: --name, --version, etc. Finally,
|
| 662 |
+
lists per-command help for every command name or command class
|
| 663 |
+
in 'commands'.
|
| 664 |
+
"""
|
| 665 |
+
# late import because of mutual dependence between these modules
|
| 666 |
+
from distutils.cmd import Command
|
| 667 |
+
from distutils.core import gen_usage
|
| 668 |
+
|
| 669 |
+
if global_options:
|
| 670 |
+
if display_options:
|
| 671 |
+
options = self._get_toplevel_options()
|
| 672 |
+
else:
|
| 673 |
+
options = self.global_options
|
| 674 |
+
parser.set_option_table(options)
|
| 675 |
+
parser.print_help(self.common_usage + "\nGlobal options:")
|
| 676 |
+
print()
|
| 677 |
+
|
| 678 |
+
if display_options:
|
| 679 |
+
parser.set_option_table(self.display_options)
|
| 680 |
+
parser.print_help(
|
| 681 |
+
"Information display options (just display information, ignore any commands)"
|
| 682 |
+
)
|
| 683 |
+
print()
|
| 684 |
+
|
| 685 |
+
for command in commands:
|
| 686 |
+
if isinstance(command, type) and issubclass(command, Command):
|
| 687 |
+
klass = command
|
| 688 |
+
else:
|
| 689 |
+
klass = self.get_command_class(command)
|
| 690 |
+
if hasattr(klass, 'help_options') and isinstance(klass.help_options, list):
|
| 691 |
+
parser.set_option_table(
|
| 692 |
+
klass.user_options + fix_help_options(klass.help_options)
|
| 693 |
+
)
|
| 694 |
+
else:
|
| 695 |
+
parser.set_option_table(klass.user_options)
|
| 696 |
+
parser.print_help(f"Options for '{klass.__name__}' command:")
|
| 697 |
+
print()
|
| 698 |
+
|
| 699 |
+
print(gen_usage(self.script_name))
|
| 700 |
+
|
| 701 |
+
def handle_display_options(self, option_order):
|
| 702 |
+
"""If there were any non-global "display-only" options
|
| 703 |
+
(--help-commands or the metadata display options) on the command
|
| 704 |
+
line, display the requested info and return true; else return
|
| 705 |
+
false.
|
| 706 |
+
"""
|
| 707 |
+
from distutils.core import gen_usage
|
| 708 |
+
|
| 709 |
+
# User just wants a list of commands -- we'll print it out and stop
|
| 710 |
+
# processing now (ie. if they ran "setup --help-commands foo bar",
|
| 711 |
+
# we ignore "foo bar").
|
| 712 |
+
if self.help_commands:
|
| 713 |
+
self.print_commands()
|
| 714 |
+
print()
|
| 715 |
+
print(gen_usage(self.script_name))
|
| 716 |
+
return 1
|
| 717 |
+
|
| 718 |
+
# If user supplied any of the "display metadata" options, then
|
| 719 |
+
# display that metadata in the order in which the user supplied the
|
| 720 |
+
# metadata options.
|
| 721 |
+
any_display_options = 0
|
| 722 |
+
is_display_option = set()
|
| 723 |
+
for option in self.display_options:
|
| 724 |
+
is_display_option.add(option[0])
|
| 725 |
+
|
| 726 |
+
for opt, val in option_order:
|
| 727 |
+
if val and opt in is_display_option:
|
| 728 |
+
opt = translate_longopt(opt)
|
| 729 |
+
value = getattr(self.metadata, "get_" + opt)()
|
| 730 |
+
if opt in ('keywords', 'platforms'):
|
| 731 |
+
print(','.join(value))
|
| 732 |
+
elif opt in ('classifiers', 'provides', 'requires', 'obsoletes'):
|
| 733 |
+
print('\n'.join(value))
|
| 734 |
+
else:
|
| 735 |
+
print(value)
|
| 736 |
+
any_display_options = 1
|
| 737 |
+
|
| 738 |
+
return any_display_options
|
| 739 |
+
|
| 740 |
+
def print_command_list(self, commands, header, max_length) -> None:
|
| 741 |
+
"""Print a subset of the list of all commands -- used by
|
| 742 |
+
'print_commands()'.
|
| 743 |
+
"""
|
| 744 |
+
print(header + ":")
|
| 745 |
+
|
| 746 |
+
for cmd in commands:
|
| 747 |
+
klass = self.cmdclass.get(cmd)
|
| 748 |
+
if not klass:
|
| 749 |
+
klass = self.get_command_class(cmd)
|
| 750 |
+
try:
|
| 751 |
+
description = klass.description
|
| 752 |
+
except AttributeError:
|
| 753 |
+
description = "(no description available)"
|
| 754 |
+
|
| 755 |
+
print(f" {cmd:<{max_length}} {description}")
|
| 756 |
+
|
| 757 |
+
def print_commands(self) -> None:
|
| 758 |
+
"""Print out a help message listing all available commands with a
|
| 759 |
+
description of each. The list is divided into "standard commands"
|
| 760 |
+
(listed in distutils.command.__all__) and "extra commands"
|
| 761 |
+
(mentioned in self.cmdclass, but not a standard command). The
|
| 762 |
+
descriptions come from the command class attribute
|
| 763 |
+
'description'.
|
| 764 |
+
"""
|
| 765 |
+
import distutils.command
|
| 766 |
+
|
| 767 |
+
std_commands = distutils.command.__all__
|
| 768 |
+
is_std = set(std_commands)
|
| 769 |
+
|
| 770 |
+
extra_commands = [cmd for cmd in self.cmdclass.keys() if cmd not in is_std]
|
| 771 |
+
|
| 772 |
+
max_length = 0
|
| 773 |
+
for cmd in std_commands + extra_commands:
|
| 774 |
+
if len(cmd) > max_length:
|
| 775 |
+
max_length = len(cmd)
|
| 776 |
+
|
| 777 |
+
self.print_command_list(std_commands, "Standard commands", max_length)
|
| 778 |
+
if extra_commands:
|
| 779 |
+
print()
|
| 780 |
+
self.print_command_list(extra_commands, "Extra commands", max_length)
|
| 781 |
+
|
| 782 |
+
def get_command_list(self):
|
| 783 |
+
"""Get a list of (command, description) tuples.
|
| 784 |
+
The list is divided into "standard commands" (listed in
|
| 785 |
+
distutils.command.__all__) and "extra commands" (mentioned in
|
| 786 |
+
self.cmdclass, but not a standard command). The descriptions come
|
| 787 |
+
from the command class attribute 'description'.
|
| 788 |
+
"""
|
| 789 |
+
# Currently this is only used on Mac OS, for the Mac-only GUI
|
| 790 |
+
# Distutils interface (by Jack Jansen)
|
| 791 |
+
import distutils.command
|
| 792 |
+
|
| 793 |
+
std_commands = distutils.command.__all__
|
| 794 |
+
is_std = set(std_commands)
|
| 795 |
+
|
| 796 |
+
extra_commands = [cmd for cmd in self.cmdclass.keys() if cmd not in is_std]
|
| 797 |
+
|
| 798 |
+
rv = []
|
| 799 |
+
for cmd in std_commands + extra_commands:
|
| 800 |
+
klass = self.cmdclass.get(cmd)
|
| 801 |
+
if not klass:
|
| 802 |
+
klass = self.get_command_class(cmd)
|
| 803 |
+
try:
|
| 804 |
+
description = klass.description
|
| 805 |
+
except AttributeError:
|
| 806 |
+
description = "(no description available)"
|
| 807 |
+
rv.append((cmd, description))
|
| 808 |
+
return rv
|
| 809 |
+
|
| 810 |
+
# -- Command class/object methods ----------------------------------
|
| 811 |
+
|
| 812 |
+
def get_command_packages(self):
|
| 813 |
+
"""Return a list of packages from which commands are loaded."""
|
| 814 |
+
pkgs = self.command_packages
|
| 815 |
+
if not isinstance(pkgs, list):
|
| 816 |
+
if pkgs is None:
|
| 817 |
+
pkgs = ''
|
| 818 |
+
pkgs = [pkg.strip() for pkg in pkgs.split(',') if pkg != '']
|
| 819 |
+
if "distutils.command" not in pkgs:
|
| 820 |
+
pkgs.insert(0, "distutils.command")
|
| 821 |
+
self.command_packages = pkgs
|
| 822 |
+
return pkgs
|
| 823 |
+
|
| 824 |
+
def get_command_class(self, command: str) -> type[Command]:
|
| 825 |
+
"""Return the class that implements the Distutils command named by
|
| 826 |
+
'command'. First we check the 'cmdclass' dictionary; if the
|
| 827 |
+
command is mentioned there, we fetch the class object from the
|
| 828 |
+
dictionary and return it. Otherwise we load the command module
|
| 829 |
+
("distutils.command." + command) and fetch the command class from
|
| 830 |
+
the module. The loaded class is also stored in 'cmdclass'
|
| 831 |
+
to speed future calls to 'get_command_class()'.
|
| 832 |
+
|
| 833 |
+
Raises DistutilsModuleError if the expected module could not be
|
| 834 |
+
found, or if that module does not define the expected class.
|
| 835 |
+
"""
|
| 836 |
+
klass = self.cmdclass.get(command)
|
| 837 |
+
if klass:
|
| 838 |
+
return klass
|
| 839 |
+
|
| 840 |
+
for pkgname in self.get_command_packages():
|
| 841 |
+
module_name = f"{pkgname}.{command}"
|
| 842 |
+
klass_name = command
|
| 843 |
+
|
| 844 |
+
try:
|
| 845 |
+
__import__(module_name)
|
| 846 |
+
module = sys.modules[module_name]
|
| 847 |
+
except ImportError:
|
| 848 |
+
continue
|
| 849 |
+
|
| 850 |
+
try:
|
| 851 |
+
klass = getattr(module, klass_name)
|
| 852 |
+
except AttributeError:
|
| 853 |
+
raise DistutilsModuleError(
|
| 854 |
+
f"invalid command '{command}' (no class '{klass_name}' in module '{module_name}')"
|
| 855 |
+
)
|
| 856 |
+
|
| 857 |
+
self.cmdclass[command] = klass
|
| 858 |
+
return klass
|
| 859 |
+
|
| 860 |
+
raise DistutilsModuleError(f"invalid command '{command}'")
|
| 861 |
+
|
| 862 |
+
@overload
|
| 863 |
+
def get_command_obj(
|
| 864 |
+
self, command: str, create: Literal[True] = True
|
| 865 |
+
) -> Command: ...
|
| 866 |
+
@overload
|
| 867 |
+
def get_command_obj(
|
| 868 |
+
self, command: str, create: Literal[False]
|
| 869 |
+
) -> Command | None: ...
|
| 870 |
+
def get_command_obj(self, command: str, create: bool = True) -> Command | None:
|
| 871 |
+
"""Return the command object for 'command'. Normally this object
|
| 872 |
+
is cached on a previous call to 'get_command_obj()'; if no command
|
| 873 |
+
object for 'command' is in the cache, then we either create and
|
| 874 |
+
return it (if 'create' is true) or return None.
|
| 875 |
+
"""
|
| 876 |
+
cmd_obj = self.command_obj.get(command)
|
| 877 |
+
if not cmd_obj and create:
|
| 878 |
+
if DEBUG:
|
| 879 |
+
self.announce(
|
| 880 |
+
"Distribution.get_command_obj(): "
|
| 881 |
+
f"creating '{command}' command object"
|
| 882 |
+
)
|
| 883 |
+
|
| 884 |
+
klass = self.get_command_class(command)
|
| 885 |
+
cmd_obj = self.command_obj[command] = klass(self)
|
| 886 |
+
self.have_run[command] = False
|
| 887 |
+
|
| 888 |
+
# Set any options that were supplied in config files
|
| 889 |
+
# or on the command line. (NB. support for error
|
| 890 |
+
# reporting is lame here: any errors aren't reported
|
| 891 |
+
# until 'finalize_options()' is called, which means
|
| 892 |
+
# we won't report the source of the error.)
|
| 893 |
+
options = self.command_options.get(command)
|
| 894 |
+
if options:
|
| 895 |
+
self._set_command_options(cmd_obj, options)
|
| 896 |
+
|
| 897 |
+
return cmd_obj
|
| 898 |
+
|
| 899 |
+
def _set_command_options(self, command_obj, option_dict=None): # noqa: C901
|
| 900 |
+
"""Set the options for 'command_obj' from 'option_dict'. Basically
|
| 901 |
+
this means copying elements of a dictionary ('option_dict') to
|
| 902 |
+
attributes of an instance ('command').
|
| 903 |
+
|
| 904 |
+
'command_obj' must be a Command instance. If 'option_dict' is not
|
| 905 |
+
supplied, uses the standard option dictionary for this command
|
| 906 |
+
(from 'self.command_options').
|
| 907 |
+
"""
|
| 908 |
+
command_name = command_obj.get_command_name()
|
| 909 |
+
if option_dict is None:
|
| 910 |
+
option_dict = self.get_option_dict(command_name)
|
| 911 |
+
|
| 912 |
+
if DEBUG:
|
| 913 |
+
self.announce(f" setting options for '{command_name}' command:")
|
| 914 |
+
for option, (source, value) in option_dict.items():
|
| 915 |
+
if DEBUG:
|
| 916 |
+
self.announce(f" {option} = {value} (from {source})")
|
| 917 |
+
try:
|
| 918 |
+
bool_opts = [translate_longopt(o) for o in command_obj.boolean_options]
|
| 919 |
+
except AttributeError:
|
| 920 |
+
bool_opts = []
|
| 921 |
+
try:
|
| 922 |
+
neg_opt = command_obj.negative_opt
|
| 923 |
+
except AttributeError:
|
| 924 |
+
neg_opt = {}
|
| 925 |
+
|
| 926 |
+
try:
|
| 927 |
+
is_string = isinstance(value, str)
|
| 928 |
+
if option in neg_opt and is_string:
|
| 929 |
+
setattr(command_obj, neg_opt[option], not strtobool(value))
|
| 930 |
+
elif option in bool_opts and is_string:
|
| 931 |
+
setattr(command_obj, option, strtobool(value))
|
| 932 |
+
elif hasattr(command_obj, option):
|
| 933 |
+
setattr(command_obj, option, value)
|
| 934 |
+
else:
|
| 935 |
+
raise DistutilsOptionError(
|
| 936 |
+
f"error in {source}: command '{command_name}' has no such option '{option}'"
|
| 937 |
+
)
|
| 938 |
+
except ValueError as msg:
|
| 939 |
+
raise DistutilsOptionError(msg)
|
| 940 |
+
|
| 941 |
+
@overload
|
| 942 |
+
def reinitialize_command(
|
| 943 |
+
self, command: str, reinit_subcommands: bool = False
|
| 944 |
+
) -> Command: ...
|
| 945 |
+
@overload
|
| 946 |
+
def reinitialize_command(
|
| 947 |
+
self, command: _CommandT, reinit_subcommands: bool = False
|
| 948 |
+
) -> _CommandT: ...
|
| 949 |
+
def reinitialize_command(
|
| 950 |
+
self, command: str | Command, reinit_subcommands=False
|
| 951 |
+
) -> Command:
|
| 952 |
+
"""Reinitializes a command to the state it was in when first
|
| 953 |
+
returned by 'get_command_obj()': ie., initialized but not yet
|
| 954 |
+
finalized. This provides the opportunity to sneak option
|
| 955 |
+
values in programmatically, overriding or supplementing
|
| 956 |
+
user-supplied values from the config files and command line.
|
| 957 |
+
You'll have to re-finalize the command object (by calling
|
| 958 |
+
'finalize_options()' or 'ensure_finalized()') before using it for
|
| 959 |
+
real.
|
| 960 |
+
|
| 961 |
+
'command' should be a command name (string) or command object. If
|
| 962 |
+
'reinit_subcommands' is true, also reinitializes the command's
|
| 963 |
+
sub-commands, as declared by the 'sub_commands' class attribute (if
|
| 964 |
+
it has one). See the "install" command for an example. Only
|
| 965 |
+
reinitializes the sub-commands that actually matter, ie. those
|
| 966 |
+
whose test predicates return true.
|
| 967 |
+
|
| 968 |
+
Returns the reinitialized command object.
|
| 969 |
+
"""
|
| 970 |
+
from distutils.cmd import Command
|
| 971 |
+
|
| 972 |
+
if not isinstance(command, Command):
|
| 973 |
+
command_name = command
|
| 974 |
+
command = self.get_command_obj(command_name)
|
| 975 |
+
else:
|
| 976 |
+
command_name = command.get_command_name()
|
| 977 |
+
|
| 978 |
+
if not command.finalized:
|
| 979 |
+
return command
|
| 980 |
+
command.initialize_options()
|
| 981 |
+
command.finalized = False
|
| 982 |
+
self.have_run[command_name] = False
|
| 983 |
+
self._set_command_options(command)
|
| 984 |
+
|
| 985 |
+
if reinit_subcommands:
|
| 986 |
+
for sub in command.get_sub_commands():
|
| 987 |
+
self.reinitialize_command(sub, reinit_subcommands)
|
| 988 |
+
|
| 989 |
+
return command
|
| 990 |
+
|
| 991 |
+
# -- Methods that operate on the Distribution ----------------------
|
| 992 |
+
|
| 993 |
+
def announce(self, msg, level: int = logging.INFO) -> None:
|
| 994 |
+
log.log(level, msg)
|
| 995 |
+
|
| 996 |
+
def run_commands(self) -> None:
|
| 997 |
+
"""Run each command that was seen on the setup script command line.
|
| 998 |
+
Uses the list of commands found and cache of command objects
|
| 999 |
+
created by 'get_command_obj()'.
|
| 1000 |
+
"""
|
| 1001 |
+
for cmd in self.commands:
|
| 1002 |
+
self.run_command(cmd)
|
| 1003 |
+
|
| 1004 |
+
# -- Methods that operate on its Commands --------------------------
|
| 1005 |
+
|
| 1006 |
+
def run_command(self, command: str) -> None:
|
| 1007 |
+
"""Do whatever it takes to run a command (including nothing at all,
|
| 1008 |
+
if the command has already been run). Specifically: if we have
|
| 1009 |
+
already created and run the command named by 'command', return
|
| 1010 |
+
silently without doing anything. If the command named by 'command'
|
| 1011 |
+
doesn't even have a command object yet, create one. Then invoke
|
| 1012 |
+
'run()' on that command object (or an existing one).
|
| 1013 |
+
"""
|
| 1014 |
+
# Already been here, done that? then return silently.
|
| 1015 |
+
if self.have_run.get(command):
|
| 1016 |
+
return
|
| 1017 |
+
|
| 1018 |
+
log.info("running %s", command)
|
| 1019 |
+
cmd_obj = self.get_command_obj(command)
|
| 1020 |
+
cmd_obj.ensure_finalized()
|
| 1021 |
+
cmd_obj.run()
|
| 1022 |
+
self.have_run[command] = True
|
| 1023 |
+
|
| 1024 |
+
# -- Distribution query methods ------------------------------------
|
| 1025 |
+
|
| 1026 |
+
def has_pure_modules(self) -> bool:
|
| 1027 |
+
return len(self.packages or self.py_modules or []) > 0
|
| 1028 |
+
|
| 1029 |
+
def has_ext_modules(self) -> bool:
|
| 1030 |
+
return self.ext_modules and len(self.ext_modules) > 0
|
| 1031 |
+
|
| 1032 |
+
def has_c_libraries(self) -> bool:
|
| 1033 |
+
return self.libraries and len(self.libraries) > 0
|
| 1034 |
+
|
| 1035 |
+
def has_modules(self) -> bool:
|
| 1036 |
+
return self.has_pure_modules() or self.has_ext_modules()
|
| 1037 |
+
|
| 1038 |
+
def has_headers(self) -> bool:
|
| 1039 |
+
return self.headers and len(self.headers) > 0
|
| 1040 |
+
|
| 1041 |
+
def has_scripts(self) -> bool:
|
| 1042 |
+
return self.scripts and len(self.scripts) > 0
|
| 1043 |
+
|
| 1044 |
+
def has_data_files(self) -> bool:
|
| 1045 |
+
return self.data_files and len(self.data_files) > 0
|
| 1046 |
+
|
| 1047 |
+
def is_pure(self) -> bool:
|
| 1048 |
+
return (
|
| 1049 |
+
self.has_pure_modules()
|
| 1050 |
+
and not self.has_ext_modules()
|
| 1051 |
+
and not self.has_c_libraries()
|
| 1052 |
+
)
|
| 1053 |
+
|
| 1054 |
+
# -- Metadata query methods ----------------------------------------
|
| 1055 |
+
|
| 1056 |
+
# If you're looking for 'get_name()', 'get_version()', and so forth,
|
| 1057 |
+
# they are defined in a sneaky way: the constructor binds self.get_XXX
|
| 1058 |
+
# to self.metadata.get_XXX. The actual code is in the
|
| 1059 |
+
# DistributionMetadata class, below.
|
| 1060 |
+
if TYPE_CHECKING:
|
| 1061 |
+
# Unfortunately this means we need to specify them manually or not expose statically
|
| 1062 |
+
def _(self) -> None:
|
| 1063 |
+
self.get_name = self.metadata.get_name
|
| 1064 |
+
self.get_version = self.metadata.get_version
|
| 1065 |
+
self.get_fullname = self.metadata.get_fullname
|
| 1066 |
+
self.get_author = self.metadata.get_author
|
| 1067 |
+
self.get_author_email = self.metadata.get_author_email
|
| 1068 |
+
self.get_maintainer = self.metadata.get_maintainer
|
| 1069 |
+
self.get_maintainer_email = self.metadata.get_maintainer_email
|
| 1070 |
+
self.get_contact = self.metadata.get_contact
|
| 1071 |
+
self.get_contact_email = self.metadata.get_contact_email
|
| 1072 |
+
self.get_url = self.metadata.get_url
|
| 1073 |
+
self.get_license = self.metadata.get_license
|
| 1074 |
+
self.get_licence = self.metadata.get_licence
|
| 1075 |
+
self.get_description = self.metadata.get_description
|
| 1076 |
+
self.get_long_description = self.metadata.get_long_description
|
| 1077 |
+
self.get_keywords = self.metadata.get_keywords
|
| 1078 |
+
self.get_platforms = self.metadata.get_platforms
|
| 1079 |
+
self.get_classifiers = self.metadata.get_classifiers
|
| 1080 |
+
self.get_download_url = self.metadata.get_download_url
|
| 1081 |
+
self.get_requires = self.metadata.get_requires
|
| 1082 |
+
self.get_provides = self.metadata.get_provides
|
| 1083 |
+
self.get_obsoletes = self.metadata.get_obsoletes
|
| 1084 |
+
|
| 1085 |
+
# Default attributes generated in __init__ from self.display_option_names
|
| 1086 |
+
help_commands: bool
|
| 1087 |
+
name: str | Literal[False]
|
| 1088 |
+
version: str | Literal[False]
|
| 1089 |
+
fullname: str | Literal[False]
|
| 1090 |
+
author: str | Literal[False]
|
| 1091 |
+
author_email: str | Literal[False]
|
| 1092 |
+
maintainer: str | Literal[False]
|
| 1093 |
+
maintainer_email: str | Literal[False]
|
| 1094 |
+
contact: str | Literal[False]
|
| 1095 |
+
contact_email: str | Literal[False]
|
| 1096 |
+
url: str | Literal[False]
|
| 1097 |
+
license: str | Literal[False]
|
| 1098 |
+
licence: str | Literal[False]
|
| 1099 |
+
description: str | Literal[False]
|
| 1100 |
+
long_description: str | Literal[False]
|
| 1101 |
+
platforms: str | list[str] | Literal[False]
|
| 1102 |
+
classifiers: str | list[str] | Literal[False]
|
| 1103 |
+
keywords: str | list[str] | Literal[False]
|
| 1104 |
+
provides: list[str] | Literal[False]
|
| 1105 |
+
requires: list[str] | Literal[False]
|
| 1106 |
+
obsoletes: list[str] | Literal[False]
|
| 1107 |
+
|
| 1108 |
+
|
| 1109 |
+
class DistributionMetadata:
|
| 1110 |
+
"""Dummy class to hold the distribution meta-data: name, version,
|
| 1111 |
+
author, and so forth.
|
| 1112 |
+
"""
|
| 1113 |
+
|
| 1114 |
+
_METHOD_BASENAMES = (
|
| 1115 |
+
"name",
|
| 1116 |
+
"version",
|
| 1117 |
+
"author",
|
| 1118 |
+
"author_email",
|
| 1119 |
+
"maintainer",
|
| 1120 |
+
"maintainer_email",
|
| 1121 |
+
"url",
|
| 1122 |
+
"license",
|
| 1123 |
+
"description",
|
| 1124 |
+
"long_description",
|
| 1125 |
+
"keywords",
|
| 1126 |
+
"platforms",
|
| 1127 |
+
"fullname",
|
| 1128 |
+
"contact",
|
| 1129 |
+
"contact_email",
|
| 1130 |
+
"classifiers",
|
| 1131 |
+
"download_url",
|
| 1132 |
+
# PEP 314
|
| 1133 |
+
"provides",
|
| 1134 |
+
"requires",
|
| 1135 |
+
"obsoletes",
|
| 1136 |
+
)
|
| 1137 |
+
|
| 1138 |
+
def __init__(
|
| 1139 |
+
self, path: str | bytes | os.PathLike[str] | os.PathLike[bytes] | None = None
|
| 1140 |
+
) -> None:
|
| 1141 |
+
if path is not None:
|
| 1142 |
+
self.read_pkg_file(open(path))
|
| 1143 |
+
else:
|
| 1144 |
+
self.name: str | None = None
|
| 1145 |
+
self.version: str | None = None
|
| 1146 |
+
self.author: str | None = None
|
| 1147 |
+
self.author_email: str | None = None
|
| 1148 |
+
self.maintainer: str | None = None
|
| 1149 |
+
self.maintainer_email: str | None = None
|
| 1150 |
+
self.url: str | None = None
|
| 1151 |
+
self.license: str | None = None
|
| 1152 |
+
self.description: str | None = None
|
| 1153 |
+
self.long_description: str | None = None
|
| 1154 |
+
self.keywords: str | list[str] | None = None
|
| 1155 |
+
self.platforms: str | list[str] | None = None
|
| 1156 |
+
self.classifiers: str | list[str] | None = None
|
| 1157 |
+
self.download_url: str | None = None
|
| 1158 |
+
# PEP 314
|
| 1159 |
+
self.provides: str | list[str] | None = None
|
| 1160 |
+
self.requires: str | list[str] | None = None
|
| 1161 |
+
self.obsoletes: str | list[str] | None = None
|
| 1162 |
+
|
| 1163 |
+
def read_pkg_file(self, file: IO[str]) -> None:
|
| 1164 |
+
"""Reads the metadata values from a file object."""
|
| 1165 |
+
msg = message_from_file(file)
|
| 1166 |
+
|
| 1167 |
+
def _read_field(name: str) -> str | None:
|
| 1168 |
+
value = msg[name]
|
| 1169 |
+
if value and value != "UNKNOWN":
|
| 1170 |
+
return value
|
| 1171 |
+
return None
|
| 1172 |
+
|
| 1173 |
+
def _read_list(name):
|
| 1174 |
+
values = msg.get_all(name, None)
|
| 1175 |
+
if values == []:
|
| 1176 |
+
return None
|
| 1177 |
+
return values
|
| 1178 |
+
|
| 1179 |
+
metadata_version = msg['metadata-version']
|
| 1180 |
+
self.name = _read_field('name')
|
| 1181 |
+
self.version = _read_field('version')
|
| 1182 |
+
self.description = _read_field('summary')
|
| 1183 |
+
# we are filling author only.
|
| 1184 |
+
self.author = _read_field('author')
|
| 1185 |
+
self.maintainer = None
|
| 1186 |
+
self.author_email = _read_field('author-email')
|
| 1187 |
+
self.maintainer_email = None
|
| 1188 |
+
self.url = _read_field('home-page')
|
| 1189 |
+
self.license = _read_field('license')
|
| 1190 |
+
|
| 1191 |
+
if 'download-url' in msg:
|
| 1192 |
+
self.download_url = _read_field('download-url')
|
| 1193 |
+
else:
|
| 1194 |
+
self.download_url = None
|
| 1195 |
+
|
| 1196 |
+
self.long_description = _read_field('description')
|
| 1197 |
+
self.description = _read_field('summary')
|
| 1198 |
+
|
| 1199 |
+
if 'keywords' in msg:
|
| 1200 |
+
self.keywords = _read_field('keywords').split(',')
|
| 1201 |
+
|
| 1202 |
+
self.platforms = _read_list('platform')
|
| 1203 |
+
self.classifiers = _read_list('classifier')
|
| 1204 |
+
|
| 1205 |
+
# PEP 314 - these fields only exist in 1.1
|
| 1206 |
+
if metadata_version == '1.1':
|
| 1207 |
+
self.requires = _read_list('requires')
|
| 1208 |
+
self.provides = _read_list('provides')
|
| 1209 |
+
self.obsoletes = _read_list('obsoletes')
|
| 1210 |
+
else:
|
| 1211 |
+
self.requires = None
|
| 1212 |
+
self.provides = None
|
| 1213 |
+
self.obsoletes = None
|
| 1214 |
+
|
| 1215 |
+
def write_pkg_info(self, base_dir: str | os.PathLike[str]) -> None:
|
| 1216 |
+
"""Write the PKG-INFO file into the release tree."""
|
| 1217 |
+
with open(
|
| 1218 |
+
os.path.join(base_dir, 'PKG-INFO'), 'w', encoding='UTF-8'
|
| 1219 |
+
) as pkg_info:
|
| 1220 |
+
self.write_pkg_file(pkg_info)
|
| 1221 |
+
|
| 1222 |
+
def write_pkg_file(self, file: SupportsWrite[str]) -> None:
|
| 1223 |
+
"""Write the PKG-INFO format data to a file object."""
|
| 1224 |
+
version = '1.0'
|
| 1225 |
+
if (
|
| 1226 |
+
self.provides
|
| 1227 |
+
or self.requires
|
| 1228 |
+
or self.obsoletes
|
| 1229 |
+
or self.classifiers
|
| 1230 |
+
or self.download_url
|
| 1231 |
+
):
|
| 1232 |
+
version = '1.1'
|
| 1233 |
+
|
| 1234 |
+
# required fields
|
| 1235 |
+
file.write(f'Metadata-Version: {version}\n')
|
| 1236 |
+
file.write(f'Name: {self.get_name()}\n')
|
| 1237 |
+
file.write(f'Version: {self.get_version()}\n')
|
| 1238 |
+
|
| 1239 |
+
def maybe_write(header, val):
|
| 1240 |
+
if val:
|
| 1241 |
+
file.write(f"{header}: {val}\n")
|
| 1242 |
+
|
| 1243 |
+
# optional fields
|
| 1244 |
+
maybe_write("Summary", self.get_description())
|
| 1245 |
+
maybe_write("Home-page", self.get_url())
|
| 1246 |
+
maybe_write("Author", self.get_contact())
|
| 1247 |
+
maybe_write("Author-email", self.get_contact_email())
|
| 1248 |
+
maybe_write("License", self.get_license())
|
| 1249 |
+
maybe_write("Download-URL", self.download_url)
|
| 1250 |
+
maybe_write("Description", rfc822_escape(self.get_long_description() or ""))
|
| 1251 |
+
maybe_write("Keywords", ",".join(self.get_keywords()))
|
| 1252 |
+
|
| 1253 |
+
self._write_list(file, 'Platform', self.get_platforms())
|
| 1254 |
+
self._write_list(file, 'Classifier', self.get_classifiers())
|
| 1255 |
+
|
| 1256 |
+
# PEP 314
|
| 1257 |
+
self._write_list(file, 'Requires', self.get_requires())
|
| 1258 |
+
self._write_list(file, 'Provides', self.get_provides())
|
| 1259 |
+
self._write_list(file, 'Obsoletes', self.get_obsoletes())
|
| 1260 |
+
|
| 1261 |
+
def _write_list(self, file, name, values):
|
| 1262 |
+
values = values or []
|
| 1263 |
+
for value in values:
|
| 1264 |
+
file.write(f'{name}: {value}\n')
|
| 1265 |
+
|
| 1266 |
+
# -- Metadata query methods ----------------------------------------
|
| 1267 |
+
|
| 1268 |
+
def get_name(self) -> str:
|
| 1269 |
+
return self.name or "UNKNOWN"
|
| 1270 |
+
|
| 1271 |
+
def get_version(self) -> str:
|
| 1272 |
+
return self.version or "0.0.0"
|
| 1273 |
+
|
| 1274 |
+
def get_fullname(self) -> str:
|
| 1275 |
+
return self._fullname(self.get_name(), self.get_version())
|
| 1276 |
+
|
| 1277 |
+
@staticmethod
|
| 1278 |
+
def _fullname(name: str, version: str) -> str:
|
| 1279 |
+
"""
|
| 1280 |
+
>>> DistributionMetadata._fullname('setup.tools', '1.0-2')
|
| 1281 |
+
'setup_tools-1.0.post2'
|
| 1282 |
+
>>> DistributionMetadata._fullname('setup-tools', '1.2post2')
|
| 1283 |
+
'setup_tools-1.2.post2'
|
| 1284 |
+
>>> DistributionMetadata._fullname('setup-tools', '1.0-r2')
|
| 1285 |
+
'setup_tools-1.0.post2'
|
| 1286 |
+
>>> DistributionMetadata._fullname('setup.tools', '1.0.post')
|
| 1287 |
+
'setup_tools-1.0.post0'
|
| 1288 |
+
>>> DistributionMetadata._fullname('setup.tools', '1.0+ubuntu-1')
|
| 1289 |
+
'setup_tools-1.0+ubuntu.1'
|
| 1290 |
+
"""
|
| 1291 |
+
return "{}-{}".format(
|
| 1292 |
+
canonicalize_name(name).replace('-', '_'),
|
| 1293 |
+
canonicalize_version(version, strip_trailing_zero=False),
|
| 1294 |
+
)
|
| 1295 |
+
|
| 1296 |
+
def get_author(self) -> str | None:
|
| 1297 |
+
return self.author
|
| 1298 |
+
|
| 1299 |
+
def get_author_email(self) -> str | None:
|
| 1300 |
+
return self.author_email
|
| 1301 |
+
|
| 1302 |
+
def get_maintainer(self) -> str | None:
|
| 1303 |
+
return self.maintainer
|
| 1304 |
+
|
| 1305 |
+
def get_maintainer_email(self) -> str | None:
|
| 1306 |
+
return self.maintainer_email
|
| 1307 |
+
|
| 1308 |
+
def get_contact(self) -> str | None:
|
| 1309 |
+
return self.maintainer or self.author
|
| 1310 |
+
|
| 1311 |
+
def get_contact_email(self) -> str | None:
|
| 1312 |
+
return self.maintainer_email or self.author_email
|
| 1313 |
+
|
| 1314 |
+
def get_url(self) -> str | None:
|
| 1315 |
+
return self.url
|
| 1316 |
+
|
| 1317 |
+
def get_license(self) -> str | None:
|
| 1318 |
+
return self.license
|
| 1319 |
+
|
| 1320 |
+
get_licence = get_license
|
| 1321 |
+
|
| 1322 |
+
def get_description(self) -> str | None:
|
| 1323 |
+
return self.description
|
| 1324 |
+
|
| 1325 |
+
def get_long_description(self) -> str | None:
|
| 1326 |
+
return self.long_description
|
| 1327 |
+
|
| 1328 |
+
def get_keywords(self) -> str | list[str]:
|
| 1329 |
+
return self.keywords or []
|
| 1330 |
+
|
| 1331 |
+
def set_keywords(self, value: str | Iterable[str]) -> None:
|
| 1332 |
+
self.keywords = _ensure_list(value, 'keywords')
|
| 1333 |
+
|
| 1334 |
+
def get_platforms(self) -> str | list[str] | None:
|
| 1335 |
+
return self.platforms
|
| 1336 |
+
|
| 1337 |
+
def set_platforms(self, value: str | Iterable[str]) -> None:
|
| 1338 |
+
self.platforms = _ensure_list(value, 'platforms')
|
| 1339 |
+
|
| 1340 |
+
def get_classifiers(self) -> str | list[str]:
|
| 1341 |
+
return self.classifiers or []
|
| 1342 |
+
|
| 1343 |
+
def set_classifiers(self, value: str | Iterable[str]) -> None:
|
| 1344 |
+
self.classifiers = _ensure_list(value, 'classifiers')
|
| 1345 |
+
|
| 1346 |
+
def get_download_url(self) -> str | None:
|
| 1347 |
+
return self.download_url
|
| 1348 |
+
|
| 1349 |
+
# PEP 314
|
| 1350 |
+
def get_requires(self) -> str | list[str]:
|
| 1351 |
+
return self.requires or []
|
| 1352 |
+
|
| 1353 |
+
def set_requires(self, value: Iterable[str]) -> None:
|
| 1354 |
+
import distutils.versionpredicate
|
| 1355 |
+
|
| 1356 |
+
for v in value:
|
| 1357 |
+
distutils.versionpredicate.VersionPredicate(v)
|
| 1358 |
+
self.requires = list(value)
|
| 1359 |
+
|
| 1360 |
+
def get_provides(self) -> str | list[str]:
|
| 1361 |
+
return self.provides or []
|
| 1362 |
+
|
| 1363 |
+
def set_provides(self, value: Iterable[str]) -> None:
|
| 1364 |
+
value = [v.strip() for v in value]
|
| 1365 |
+
for v in value:
|
| 1366 |
+
import distutils.versionpredicate
|
| 1367 |
+
|
| 1368 |
+
distutils.versionpredicate.split_provision(v)
|
| 1369 |
+
self.provides = value
|
| 1370 |
+
|
| 1371 |
+
def get_obsoletes(self) -> str | list[str]:
|
| 1372 |
+
return self.obsoletes or []
|
| 1373 |
+
|
| 1374 |
+
def set_obsoletes(self, value: Iterable[str]) -> None:
|
| 1375 |
+
import distutils.versionpredicate
|
| 1376 |
+
|
| 1377 |
+
for v in value:
|
| 1378 |
+
distutils.versionpredicate.VersionPredicate(v)
|
| 1379 |
+
self.obsoletes = list(value)
|
| 1380 |
+
|
| 1381 |
+
|
| 1382 |
+
def fix_help_options(options):
|
| 1383 |
+
"""Convert a 4-tuple 'help_options' list as found in various command
|
| 1384 |
+
classes to the 3-tuple form required by FancyGetopt.
|
| 1385 |
+
"""
|
| 1386 |
+
return [opt[0:3] for opt in options]
|
project/ManiSkill3/src/maniskill2_benchmark/mani_skill2_repo/.eggs/setuptools-80.9.0-py3.10.egg/setuptools/_distutils/fancy_getopt.py
ADDED
|
@@ -0,0 +1,471 @@
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""distutils.fancy_getopt
|
| 2 |
+
|
| 3 |
+
Wrapper around the standard getopt module that provides the following
|
| 4 |
+
additional features:
|
| 5 |
+
* short and long options are tied together
|
| 6 |
+
* options have help strings, so fancy_getopt could potentially
|
| 7 |
+
create a complete usage summary
|
| 8 |
+
* options set attributes of a passed-in object
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from __future__ import annotations
|
| 12 |
+
|
| 13 |
+
import getopt
|
| 14 |
+
import re
|
| 15 |
+
import string
|
| 16 |
+
import sys
|
| 17 |
+
from collections.abc import Sequence
|
| 18 |
+
from typing import Any
|
| 19 |
+
|
| 20 |
+
from .errors import DistutilsArgError, DistutilsGetoptError
|
| 21 |
+
|
| 22 |
+
# Much like command_re in distutils.core, this is close to but not quite
|
| 23 |
+
# the same as a Python NAME -- except, in the spirit of most GNU
|
| 24 |
+
# utilities, we use '-' in place of '_'. (The spirit of LISP lives on!)
|
| 25 |
+
# The similarities to NAME are again not a coincidence...
|
| 26 |
+
longopt_pat = r'[a-zA-Z](?:[a-zA-Z0-9-]*)'
|
| 27 |
+
longopt_re = re.compile(rf'^{longopt_pat}$')
|
| 28 |
+
|
| 29 |
+
# For recognizing "negative alias" options, eg. "quiet=!verbose"
|
| 30 |
+
neg_alias_re = re.compile(f"^({longopt_pat})=!({longopt_pat})$")
|
| 31 |
+
|
| 32 |
+
# This is used to translate long options to legitimate Python identifiers
|
| 33 |
+
# (for use as attributes of some object).
|
| 34 |
+
longopt_xlate = str.maketrans('-', '_')
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
class FancyGetopt:
|
| 38 |
+
"""Wrapper around the standard 'getopt()' module that provides some
|
| 39 |
+
handy extra functionality:
|
| 40 |
+
* short and long options are tied together
|
| 41 |
+
* options have help strings, and help text can be assembled
|
| 42 |
+
from them
|
| 43 |
+
* options set attributes of a passed-in object
|
| 44 |
+
* boolean options can have "negative aliases" -- eg. if
|
| 45 |
+
--quiet is the "negative alias" of --verbose, then "--quiet"
|
| 46 |
+
on the command line sets 'verbose' to false
|
| 47 |
+
"""
|
| 48 |
+
|
| 49 |
+
def __init__(self, option_table=None):
|
| 50 |
+
# The option table is (currently) a list of tuples. The
|
| 51 |
+
# tuples may have 3 or four values:
|
| 52 |
+
# (long_option, short_option, help_string [, repeatable])
|
| 53 |
+
# if an option takes an argument, its long_option should have '='
|
| 54 |
+
# appended; short_option should just be a single character, no ':'
|
| 55 |
+
# in any case. If a long_option doesn't have a corresponding
|
| 56 |
+
# short_option, short_option should be None. All option tuples
|
| 57 |
+
# must have long options.
|
| 58 |
+
self.option_table = option_table
|
| 59 |
+
|
| 60 |
+
# 'option_index' maps long option names to entries in the option
|
| 61 |
+
# table (ie. those 3-tuples).
|
| 62 |
+
self.option_index = {}
|
| 63 |
+
if self.option_table:
|
| 64 |
+
self._build_index()
|
| 65 |
+
|
| 66 |
+
# 'alias' records (duh) alias options; {'foo': 'bar'} means
|
| 67 |
+
# --foo is an alias for --bar
|
| 68 |
+
self.alias = {}
|
| 69 |
+
|
| 70 |
+
# 'negative_alias' keeps track of options that are the boolean
|
| 71 |
+
# opposite of some other option
|
| 72 |
+
self.negative_alias = {}
|
| 73 |
+
|
| 74 |
+
# These keep track of the information in the option table. We
|
| 75 |
+
# don't actually populate these structures until we're ready to
|
| 76 |
+
# parse the command-line, since the 'option_table' passed in here
|
| 77 |
+
# isn't necessarily the final word.
|
| 78 |
+
self.short_opts = []
|
| 79 |
+
self.long_opts = []
|
| 80 |
+
self.short2long = {}
|
| 81 |
+
self.attr_name = {}
|
| 82 |
+
self.takes_arg = {}
|
| 83 |
+
|
| 84 |
+
# And 'option_order' is filled up in 'getopt()'; it records the
|
| 85 |
+
# original order of options (and their values) on the command-line,
|
| 86 |
+
# but expands short options, converts aliases, etc.
|
| 87 |
+
self.option_order = []
|
| 88 |
+
|
| 89 |
+
def _build_index(self):
|
| 90 |
+
self.option_index.clear()
|
| 91 |
+
for option in self.option_table:
|
| 92 |
+
self.option_index[option[0]] = option
|
| 93 |
+
|
| 94 |
+
def set_option_table(self, option_table):
|
| 95 |
+
self.option_table = option_table
|
| 96 |
+
self._build_index()
|
| 97 |
+
|
| 98 |
+
def add_option(self, long_option, short_option=None, help_string=None):
|
| 99 |
+
if long_option in self.option_index:
|
| 100 |
+
raise DistutilsGetoptError(
|
| 101 |
+
f"option conflict: already an option '{long_option}'"
|
| 102 |
+
)
|
| 103 |
+
else:
|
| 104 |
+
option = (long_option, short_option, help_string)
|
| 105 |
+
self.option_table.append(option)
|
| 106 |
+
self.option_index[long_option] = option
|
| 107 |
+
|
| 108 |
+
def has_option(self, long_option):
|
| 109 |
+
"""Return true if the option table for this parser has an
|
| 110 |
+
option with long name 'long_option'."""
|
| 111 |
+
return long_option in self.option_index
|
| 112 |
+
|
| 113 |
+
def get_attr_name(self, long_option):
|
| 114 |
+
"""Translate long option name 'long_option' to the form it
|
| 115 |
+
has as an attribute of some object: ie., translate hyphens
|
| 116 |
+
to underscores."""
|
| 117 |
+
return long_option.translate(longopt_xlate)
|
| 118 |
+
|
| 119 |
+
def _check_alias_dict(self, aliases, what):
|
| 120 |
+
assert isinstance(aliases, dict)
|
| 121 |
+
for alias, opt in aliases.items():
|
| 122 |
+
if alias not in self.option_index:
|
| 123 |
+
raise DistutilsGetoptError(
|
| 124 |
+
f"invalid {what} '{alias}': option '{alias}' not defined"
|
| 125 |
+
)
|
| 126 |
+
if opt not in self.option_index:
|
| 127 |
+
raise DistutilsGetoptError(
|
| 128 |
+
f"invalid {what} '{alias}': aliased option '{opt}' not defined"
|
| 129 |
+
)
|
| 130 |
+
|
| 131 |
+
def set_aliases(self, alias):
|
| 132 |
+
"""Set the aliases for this option parser."""
|
| 133 |
+
self._check_alias_dict(alias, "alias")
|
| 134 |
+
self.alias = alias
|
| 135 |
+
|
| 136 |
+
def set_negative_aliases(self, negative_alias):
|
| 137 |
+
"""Set the negative aliases for this option parser.
|
| 138 |
+
'negative_alias' should be a dictionary mapping option names to
|
| 139 |
+
option names, both the key and value must already be defined
|
| 140 |
+
in the option table."""
|
| 141 |
+
self._check_alias_dict(negative_alias, "negative alias")
|
| 142 |
+
self.negative_alias = negative_alias
|
| 143 |
+
|
| 144 |
+
def _grok_option_table(self): # noqa: C901
|
| 145 |
+
"""Populate the various data structures that keep tabs on the
|
| 146 |
+
option table. Called by 'getopt()' before it can do anything
|
| 147 |
+
worthwhile.
|
| 148 |
+
"""
|
| 149 |
+
self.long_opts = []
|
| 150 |
+
self.short_opts = []
|
| 151 |
+
self.short2long.clear()
|
| 152 |
+
self.repeat = {}
|
| 153 |
+
|
| 154 |
+
for option in self.option_table:
|
| 155 |
+
if len(option) == 3:
|
| 156 |
+
long, short, help = option
|
| 157 |
+
repeat = 0
|
| 158 |
+
elif len(option) == 4:
|
| 159 |
+
long, short, help, repeat = option
|
| 160 |
+
else:
|
| 161 |
+
# the option table is part of the code, so simply
|
| 162 |
+
# assert that it is correct
|
| 163 |
+
raise ValueError(f"invalid option tuple: {option!r}")
|
| 164 |
+
|
| 165 |
+
# Type- and value-check the option names
|
| 166 |
+
if not isinstance(long, str) or len(long) < 2:
|
| 167 |
+
raise DistutilsGetoptError(
|
| 168 |
+
f"invalid long option '{long}': must be a string of length >= 2"
|
| 169 |
+
)
|
| 170 |
+
|
| 171 |
+
if not ((short is None) or (isinstance(short, str) and len(short) == 1)):
|
| 172 |
+
raise DistutilsGetoptError(
|
| 173 |
+
f"invalid short option '{short}': must a single character or None"
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
self.repeat[long] = repeat
|
| 177 |
+
self.long_opts.append(long)
|
| 178 |
+
|
| 179 |
+
if long[-1] == '=': # option takes an argument?
|
| 180 |
+
if short:
|
| 181 |
+
short = short + ':'
|
| 182 |
+
long = long[0:-1]
|
| 183 |
+
self.takes_arg[long] = True
|
| 184 |
+
else:
|
| 185 |
+
# Is option is a "negative alias" for some other option (eg.
|
| 186 |
+
# "quiet" == "!verbose")?
|
| 187 |
+
alias_to = self.negative_alias.get(long)
|
| 188 |
+
if alias_to is not None:
|
| 189 |
+
if self.takes_arg[alias_to]:
|
| 190 |
+
raise DistutilsGetoptError(
|
| 191 |
+
f"invalid negative alias '{long}': "
|
| 192 |
+
f"aliased option '{alias_to}' takes a value"
|
| 193 |
+
)
|
| 194 |
+
|
| 195 |
+
self.long_opts[-1] = long # XXX redundant?!
|
| 196 |
+
self.takes_arg[long] = False
|
| 197 |
+
|
| 198 |
+
# If this is an alias option, make sure its "takes arg" flag is
|
| 199 |
+
# the same as the option it's aliased to.
|
| 200 |
+
alias_to = self.alias.get(long)
|
| 201 |
+
if alias_to is not None:
|
| 202 |
+
if self.takes_arg[long] != self.takes_arg[alias_to]:
|
| 203 |
+
raise DistutilsGetoptError(
|
| 204 |
+
f"invalid alias '{long}': inconsistent with "
|
| 205 |
+
f"aliased option '{alias_to}' (one of them takes a value, "
|
| 206 |
+
"the other doesn't"
|
| 207 |
+
)
|
| 208 |
+
|
| 209 |
+
# Now enforce some bondage on the long option name, so we can
|
| 210 |
+
# later translate it to an attribute name on some object. Have
|
| 211 |
+
# to do this a bit late to make sure we've removed any trailing
|
| 212 |
+
# '='.
|
| 213 |
+
if not longopt_re.match(long):
|
| 214 |
+
raise DistutilsGetoptError(
|
| 215 |
+
f"invalid long option name '{long}' "
|
| 216 |
+
"(must be letters, numbers, hyphens only"
|
| 217 |
+
)
|
| 218 |
+
|
| 219 |
+
self.attr_name[long] = self.get_attr_name(long)
|
| 220 |
+
if short:
|
| 221 |
+
self.short_opts.append(short)
|
| 222 |
+
self.short2long[short[0]] = long
|
| 223 |
+
|
| 224 |
+
def getopt(self, args: Sequence[str] | None = None, object=None): # noqa: C901
|
| 225 |
+
"""Parse command-line options in args. Store as attributes on object.
|
| 226 |
+
|
| 227 |
+
If 'args' is None or not supplied, uses 'sys.argv[1:]'. If
|
| 228 |
+
'object' is None or not supplied, creates a new OptionDummy
|
| 229 |
+
object, stores option values there, and returns a tuple (args,
|
| 230 |
+
object). If 'object' is supplied, it is modified in place and
|
| 231 |
+
'getopt()' just returns 'args'; in both cases, the returned
|
| 232 |
+
'args' is a modified copy of the passed-in 'args' list, which
|
| 233 |
+
is left untouched.
|
| 234 |
+
"""
|
| 235 |
+
if args is None:
|
| 236 |
+
args = sys.argv[1:]
|
| 237 |
+
if object is None:
|
| 238 |
+
object = OptionDummy()
|
| 239 |
+
created_object = True
|
| 240 |
+
else:
|
| 241 |
+
created_object = False
|
| 242 |
+
|
| 243 |
+
self._grok_option_table()
|
| 244 |
+
|
| 245 |
+
short_opts = ' '.join(self.short_opts)
|
| 246 |
+
try:
|
| 247 |
+
opts, args = getopt.getopt(args, short_opts, self.long_opts)
|
| 248 |
+
except getopt.error as msg:
|
| 249 |
+
raise DistutilsArgError(msg)
|
| 250 |
+
|
| 251 |
+
for opt, val in opts:
|
| 252 |
+
if len(opt) == 2 and opt[0] == '-': # it's a short option
|
| 253 |
+
opt = self.short2long[opt[1]]
|
| 254 |
+
else:
|
| 255 |
+
assert len(opt) > 2 and opt[:2] == '--'
|
| 256 |
+
opt = opt[2:]
|
| 257 |
+
|
| 258 |
+
alias = self.alias.get(opt)
|
| 259 |
+
if alias:
|
| 260 |
+
opt = alias
|
| 261 |
+
|
| 262 |
+
if not self.takes_arg[opt]: # boolean option?
|
| 263 |
+
assert val == '', "boolean option can't have value"
|
| 264 |
+
alias = self.negative_alias.get(opt)
|
| 265 |
+
if alias:
|
| 266 |
+
opt = alias
|
| 267 |
+
val = 0
|
| 268 |
+
else:
|
| 269 |
+
val = 1
|
| 270 |
+
|
| 271 |
+
attr = self.attr_name[opt]
|
| 272 |
+
# The only repeating option at the moment is 'verbose'.
|
| 273 |
+
# It has a negative option -q quiet, which should set verbose = False.
|
| 274 |
+
if val and self.repeat.get(attr) is not None:
|
| 275 |
+
val = getattr(object, attr, 0) + 1
|
| 276 |
+
setattr(object, attr, val)
|
| 277 |
+
self.option_order.append((opt, val))
|
| 278 |
+
|
| 279 |
+
# for opts
|
| 280 |
+
if created_object:
|
| 281 |
+
return args, object
|
| 282 |
+
else:
|
| 283 |
+
return args
|
| 284 |
+
|
| 285 |
+
def get_option_order(self):
|
| 286 |
+
"""Returns the list of (option, value) tuples processed by the
|
| 287 |
+
previous run of 'getopt()'. Raises RuntimeError if
|
| 288 |
+
'getopt()' hasn't been called yet.
|
| 289 |
+
"""
|
| 290 |
+
if self.option_order is None:
|
| 291 |
+
raise RuntimeError("'getopt()' hasn't been called yet")
|
| 292 |
+
else:
|
| 293 |
+
return self.option_order
|
| 294 |
+
|
| 295 |
+
def generate_help(self, header=None): # noqa: C901
|
| 296 |
+
"""Generate help text (a list of strings, one per suggested line of
|
| 297 |
+
output) from the option table for this FancyGetopt object.
|
| 298 |
+
"""
|
| 299 |
+
# Blithely assume the option table is good: probably wouldn't call
|
| 300 |
+
# 'generate_help()' unless you've already called 'getopt()'.
|
| 301 |
+
|
| 302 |
+
# First pass: determine maximum length of long option names
|
| 303 |
+
max_opt = 0
|
| 304 |
+
for option in self.option_table:
|
| 305 |
+
long = option[0]
|
| 306 |
+
short = option[1]
|
| 307 |
+
ell = len(long)
|
| 308 |
+
if long[-1] == '=':
|
| 309 |
+
ell = ell - 1
|
| 310 |
+
if short is not None:
|
| 311 |
+
ell = ell + 5 # " (-x)" where short == 'x'
|
| 312 |
+
if ell > max_opt:
|
| 313 |
+
max_opt = ell
|
| 314 |
+
|
| 315 |
+
opt_width = max_opt + 2 + 2 + 2 # room for indent + dashes + gutter
|
| 316 |
+
|
| 317 |
+
# Typical help block looks like this:
|
| 318 |
+
# --foo controls foonabulation
|
| 319 |
+
# Help block for longest option looks like this:
|
| 320 |
+
# --flimflam set the flim-flam level
|
| 321 |
+
# and with wrapped text:
|
| 322 |
+
# --flimflam set the flim-flam level (must be between
|
| 323 |
+
# 0 and 100, except on Tuesdays)
|
| 324 |
+
# Options with short names will have the short name shown (but
|
| 325 |
+
# it doesn't contribute to max_opt):
|
| 326 |
+
# --foo (-f) controls foonabulation
|
| 327 |
+
# If adding the short option would make the left column too wide,
|
| 328 |
+
# we push the explanation off to the next line
|
| 329 |
+
# --flimflam (-l)
|
| 330 |
+
# set the flim-flam level
|
| 331 |
+
# Important parameters:
|
| 332 |
+
# - 2 spaces before option block start lines
|
| 333 |
+
# - 2 dashes for each long option name
|
| 334 |
+
# - min. 2 spaces between option and explanation (gutter)
|
| 335 |
+
# - 5 characters (incl. space) for short option name
|
| 336 |
+
|
| 337 |
+
# Now generate lines of help text. (If 80 columns were good enough
|
| 338 |
+
# for Jesus, then 78 columns are good enough for me!)
|
| 339 |
+
line_width = 78
|
| 340 |
+
text_width = line_width - opt_width
|
| 341 |
+
big_indent = ' ' * opt_width
|
| 342 |
+
if header:
|
| 343 |
+
lines = [header]
|
| 344 |
+
else:
|
| 345 |
+
lines = ['Option summary:']
|
| 346 |
+
|
| 347 |
+
for option in self.option_table:
|
| 348 |
+
long, short, help = option[:3]
|
| 349 |
+
text = wrap_text(help, text_width)
|
| 350 |
+
if long[-1] == '=':
|
| 351 |
+
long = long[0:-1]
|
| 352 |
+
|
| 353 |
+
# Case 1: no short option at all (makes life easy)
|
| 354 |
+
if short is None:
|
| 355 |
+
if text:
|
| 356 |
+
lines.append(f" --{long:<{max_opt}} {text[0]}")
|
| 357 |
+
else:
|
| 358 |
+
lines.append(f" --{long:<{max_opt}}")
|
| 359 |
+
|
| 360 |
+
# Case 2: we have a short option, so we have to include it
|
| 361 |
+
# just after the long option
|
| 362 |
+
else:
|
| 363 |
+
opt_names = f"{long} (-{short})"
|
| 364 |
+
if text:
|
| 365 |
+
lines.append(f" --{opt_names:<{max_opt}} {text[0]}")
|
| 366 |
+
else:
|
| 367 |
+
lines.append(f" --{opt_names:<{max_opt}}")
|
| 368 |
+
|
| 369 |
+
for ell in text[1:]:
|
| 370 |
+
lines.append(big_indent + ell)
|
| 371 |
+
return lines
|
| 372 |
+
|
| 373 |
+
def print_help(self, header=None, file=None):
|
| 374 |
+
if file is None:
|
| 375 |
+
file = sys.stdout
|
| 376 |
+
for line in self.generate_help(header):
|
| 377 |
+
file.write(line + "\n")
|
| 378 |
+
|
| 379 |
+
|
| 380 |
+
def fancy_getopt(options, negative_opt, object, args: Sequence[str] | None):
|
| 381 |
+
parser = FancyGetopt(options)
|
| 382 |
+
parser.set_negative_aliases(negative_opt)
|
| 383 |
+
return parser.getopt(args, object)
|
| 384 |
+
|
| 385 |
+
|
| 386 |
+
WS_TRANS = {ord(_wschar): ' ' for _wschar in string.whitespace}
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
def wrap_text(text, width):
|
| 390 |
+
"""wrap_text(text : string, width : int) -> [string]
|
| 391 |
+
|
| 392 |
+
Split 'text' into multiple lines of no more than 'width' characters
|
| 393 |
+
each, and return the list of strings that results.
|
| 394 |
+
"""
|
| 395 |
+
if text is None:
|
| 396 |
+
return []
|
| 397 |
+
if len(text) <= width:
|
| 398 |
+
return [text]
|
| 399 |
+
|
| 400 |
+
text = text.expandtabs()
|
| 401 |
+
text = text.translate(WS_TRANS)
|
| 402 |
+
chunks = re.split(r'( +|-+)', text)
|
| 403 |
+
chunks = [ch for ch in chunks if ch] # ' - ' results in empty strings
|
| 404 |
+
lines = []
|
| 405 |
+
|
| 406 |
+
while chunks:
|
| 407 |
+
cur_line = [] # list of chunks (to-be-joined)
|
| 408 |
+
cur_len = 0 # length of current line
|
| 409 |
+
|
| 410 |
+
while chunks:
|
| 411 |
+
ell = len(chunks[0])
|
| 412 |
+
if cur_len + ell <= width: # can squeeze (at least) this chunk in
|
| 413 |
+
cur_line.append(chunks[0])
|
| 414 |
+
del chunks[0]
|
| 415 |
+
cur_len = cur_len + ell
|
| 416 |
+
else: # this line is full
|
| 417 |
+
# drop last chunk if all space
|
| 418 |
+
if cur_line and cur_line[-1][0] == ' ':
|
| 419 |
+
del cur_line[-1]
|
| 420 |
+
break
|
| 421 |
+
|
| 422 |
+
if chunks: # any chunks left to process?
|
| 423 |
+
# if the current line is still empty, then we had a single
|
| 424 |
+
# chunk that's too big too fit on a line -- so we break
|
| 425 |
+
# down and break it up at the line width
|
| 426 |
+
if cur_len == 0:
|
| 427 |
+
cur_line.append(chunks[0][0:width])
|
| 428 |
+
chunks[0] = chunks[0][width:]
|
| 429 |
+
|
| 430 |
+
# all-whitespace chunks at the end of a line can be discarded
|
| 431 |
+
# (and we know from the re.split above that if a chunk has
|
| 432 |
+
# *any* whitespace, it is *all* whitespace)
|
| 433 |
+
if chunks[0][0] == ' ':
|
| 434 |
+
del chunks[0]
|
| 435 |
+
|
| 436 |
+
# and store this line in the list-of-all-lines -- as a single
|
| 437 |
+
# string, of course!
|
| 438 |
+
lines.append(''.join(cur_line))
|
| 439 |
+
|
| 440 |
+
return lines
|
| 441 |
+
|
| 442 |
+
|
| 443 |
+
def translate_longopt(opt):
|
| 444 |
+
"""Convert a long option name to a valid Python identifier by
|
| 445 |
+
changing "-" to "_".
|
| 446 |
+
"""
|
| 447 |
+
return opt.translate(longopt_xlate)
|
| 448 |
+
|
| 449 |
+
|
| 450 |
+
class OptionDummy:
|
| 451 |
+
"""Dummy class just used as a place to hold command-line option
|
| 452 |
+
values as instance attributes."""
|
| 453 |
+
|
| 454 |
+
def __init__(self, options: Sequence[Any] = []):
|
| 455 |
+
"""Create a new OptionDummy instance. The attributes listed in
|
| 456 |
+
'options' will be initialized to None."""
|
| 457 |
+
for opt in options:
|
| 458 |
+
setattr(self, opt, None)
|
| 459 |
+
|
| 460 |
+
|
| 461 |
+
if __name__ == "__main__":
|
| 462 |
+
text = """\
|
| 463 |
+
Tra-la-la, supercalifragilisticexpialidocious.
|
| 464 |
+
How *do* you spell that odd word, anyways?
|
| 465 |
+
(Someone ask Mary -- she'll know [or she'll
|
| 466 |
+
say, "How should I know?"].)"""
|
| 467 |
+
|
| 468 |
+
for w in (10, 20, 30, 40):
|
| 469 |
+
print(f"width: {w}")
|
| 470 |
+
print("\n".join(wrap_text(text, w)))
|
| 471 |
+
print()
|
project/ManiSkill3/src/maniskill2_benchmark/mani_skill2_repo/.eggs/setuptools-80.9.0-py3.10.egg/setuptools/_distutils/unixccompiler.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import importlib
|
| 2 |
+
|
| 3 |
+
from .compilers.C import unix
|
| 4 |
+
|
| 5 |
+
UnixCCompiler = unix.Compiler
|
| 6 |
+
|
| 7 |
+
# ensure import of unixccompiler implies ccompiler imported
|
| 8 |
+
# (pypa/setuptools#4871)
|
| 9 |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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections import defaultdict
|
| 2 |
+
from functools import partial
|
| 3 |
+
import os
|
| 4 |
+
import pathlib
|
| 5 |
+
from typing import Callable, Final, Literal
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
import numpy as np
|
| 9 |
+
import json
|
| 10 |
+
import sapien.core as sapien
|
| 11 |
+
from transforms3d.euler import euler2quat
|
| 12 |
+
from sapien.core import Pose
|
| 13 |
+
from transforms3d.quaternions import qmult
|
| 14 |
+
|
| 15 |
+
import yaml
|
| 16 |
+
from mani_skill2 import format_path
|
| 17 |
+
from mani_skill2.envs.sapien_env import BaseEnv
|
| 18 |
+
from mani_skill2.utils.io_utils import load_json
|
| 19 |
+
from mani_skill2.utils.geometry import get_axis_aligned_bbox_for_actor
|
| 20 |
+
from mani_skill2.utils.registration import register_env
|
| 21 |
+
from mani_skill2.sensors.camera import CameraConfig
|
| 22 |
+
from mani_skill2.utils.sapien_utils import (
|
| 23 |
+
look_at,
|
| 24 |
+
vectorize_pose,
|
| 25 |
+
)
|
| 26 |
+
from cfdp.utils.object_placement import PlacementBounds, ObjectBoundingBox, find_valid_position_2d
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
from cfdp.envs import assets
|
| 30 |
+
from cfdp.envs.random_obstacle_reach_env import RandomObstacleReachEnv
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
OUT_OF_BOUNDS: Final = np.array([0, 0, -900])
|
| 34 |
+
OBJECTS_KEY = 'objects'
|
| 35 |
+
|
| 36 |
+
@register_env(
|
| 37 |
+
"SceneGenerator-v0",
|
| 38 |
+
max_episode_steps=1,
|
| 39 |
+
)
|
| 40 |
+
class SceneGeneratorEnv(RandomObstacleReachEnv):
|
| 41 |
+
"""This environment generates actors at runtime and outputs the new scene to a YAML config.
|
| 42 |
+
|
| 43 |
+
This config can be retrieved in info['gen_scene'] on reset.
|
| 44 |
+
"""
|
| 45 |
+
def __init__(
|
| 46 |
+
self,
|
| 47 |
+
*args,
|
| 48 |
+
distractor_count: int,
|
| 49 |
+
object_place_bounds: tuple[tuple[float, float], tuple[float, float], tuple[float]] | None = None,
|
| 50 |
+
asset_root=str(pathlib.Path(assets.__file__).parent),
|
| 51 |
+
base_object_config_path: str | pathlib.Path,
|
| 52 |
+
model_config="asset_tables.yaml",
|
| 53 |
+
scene_config_serialization_mode: Literal["yaml", "json", "dict"] = "yaml",
|
| 54 |
+
distractor_rotation_axes: tuple[bool, bool, bool] = (False, False, True),
|
| 55 |
+
minimum_object_aabb_separation=0.05, # this can be below 0
|
| 56 |
+
table_scale: list[float, float] = [1.0, 1.0],
|
| 57 |
+
**kwargs
|
| 58 |
+
|
| 59 |
+
):
|
| 60 |
+
self.asset_root = asset_root
|
| 61 |
+
self.model_configs = model_config
|
| 62 |
+
self.base_scene_config_path=base_object_config_path
|
| 63 |
+
self.table_scale = table_scale
|
| 64 |
+
|
| 65 |
+
model_db_path = self._get_asset_path(self.model_configs)
|
| 66 |
+
# Load object configurations before calling parent's __init__
|
| 67 |
+
with open(model_db_path, 'r') as f:
|
| 68 |
+
self.model_db = yaml.safe_load(f)
|
| 69 |
+
|
| 70 |
+
object_config_path = self._get_asset_path(self.base_scene_config_path)
|
| 71 |
+
|
| 72 |
+
# Load object configurations before calling parent's __init__
|
| 73 |
+
with open(object_config_path, 'r') as f:
|
| 74 |
+
self.base_object_configs = yaml.safe_load(f)
|
| 75 |
+
self.base_object_configs[OBJECTS_KEY] = _key_hierarchy_dict(self.base_object_configs[OBJECTS_KEY])
|
| 76 |
+
|
| 77 |
+
self._initial_actor_states = {}
|
| 78 |
+
self._distractor_count = distractor_count
|
| 79 |
+
self._object_place_bounds = object_place_bounds
|
| 80 |
+
self._minimum_object_aabb_separation = minimum_object_aabb_separation
|
| 81 |
+
|
| 82 |
+
self.scene_serializer_func: Callable[[str], dict]
|
| 83 |
+
if scene_config_serialization_mode == "json":
|
| 84 |
+
self.scene_serializer_func = partial(
|
| 85 |
+
json.dumps,
|
| 86 |
+
allow_nan=False,
|
| 87 |
+
)
|
| 88 |
+
elif scene_config_serialization_mode == "yaml":
|
| 89 |
+
self.scene_serializer_func = partial(
|
| 90 |
+
yaml.dump,
|
| 91 |
+
encoding='utf-8',
|
| 92 |
+
allow_unicode=True,
|
| 93 |
+
# sort_keys=False,
|
| 94 |
+
# default_flow_style=None,
|
| 95 |
+
# indent=4,
|
| 96 |
+
# width=120,
|
| 97 |
+
)
|
| 98 |
+
elif scene_config_serialization_mode == "dict":
|
| 99 |
+
# Just passthrough
|
| 100 |
+
self.scene_serializer_func = lambda d: d
|
| 101 |
+
else:
|
| 102 |
+
raise ValueError("Invalid serialization mode. Choose from 'json', 'yaml', or 'dict'")
|
| 103 |
+
|
| 104 |
+
self.new_distractors = []
|
| 105 |
+
self._generated_object_configs = {
|
| 106 |
+
OBJECTS_KEY: defaultdict(dict),
|
| 107 |
+
}
|
| 108 |
+
self._generated_object_configs[OBJECTS_KEY].update(self.base_object_configs[OBJECTS_KEY])
|
| 109 |
+
|
| 110 |
+
self.ycb_objects: dict[str, sapien.Actor] = {}
|
| 111 |
+
self.obstacle_actors: dict[str, sapien.Actor] = {}
|
| 112 |
+
self.distractor_rotation_axes = distractor_rotation_axes
|
| 113 |
+
|
| 114 |
+
super().__init__(*args, **kwargs)
|
| 115 |
+
self.goal_thresh = 0.01
|
| 116 |
+
self.min_goal_dist = 0.2
|
| 117 |
+
|
| 118 |
+
def _get_asset_path(self, asset):
|
| 119 |
+
resolved_asset = format_path(asset)
|
| 120 |
+
return (
|
| 121 |
+
str(pathlib.Path(self.asset_root) / resolved_asset)
|
| 122 |
+
if not os.path.isabs(asset)
|
| 123 |
+
else resolved_asset
|
| 124 |
+
)
|
| 125 |
+
|
| 126 |
+
def _settle(self, t):
|
| 127 |
+
# step the simulation and let the scene settle for t seconds
|
| 128 |
+
settle(self, t)
|
| 129 |
+
|
| 130 |
+
def _load_actors(self):
|
| 131 |
+
"""Load actors only, state is set later in _initialize()."""
|
| 132 |
+
self._add_ground(render=self.bg_name is None, altitude=-0.8)
|
| 133 |
+
self.goal_site = self._build_sphere_site(radius=0.01)
|
| 134 |
+
|
| 135 |
+
# Clear previous obstacles
|
| 136 |
+
self.obstacles = []
|
| 137 |
+
all_points = []
|
| 138 |
+
|
| 139 |
+
self._load_base_scene_actors()
|
| 140 |
+
self._load_new_obstacles()
|
| 141 |
+
self._load_new_ycb_distractors()
|
| 142 |
+
|
| 143 |
+
# Process each obstacle configuration
|
| 144 |
+
for obstacle_config in self.obstacle_configs:
|
| 145 |
+
obstacle_type = obstacle_config.get('type', 'box')
|
| 146 |
+
if obstacle_type == 'box':
|
| 147 |
+
obstacle, points = self._create_box_obstacle(obstacle_config)
|
| 148 |
+
elif obstacle_type == 'sphere':
|
| 149 |
+
obstacle, points = self._create_sphere_obstacle(obstacle_config)
|
| 150 |
+
elif obstacle_type == 'mesh':
|
| 151 |
+
obstacle, points = self._create_mesh_obstacle(obstacle_config)
|
| 152 |
+
else:
|
| 153 |
+
raise ValueError(f"Unsupported obstacle type: {obstacle_type}")
|
| 154 |
+
|
| 155 |
+
self.obstacles.append(obstacle)
|
| 156 |
+
all_points.append(points)
|
| 157 |
+
|
| 158 |
+
if all_points:
|
| 159 |
+
self.obstacle_point_cloud = np.vstack(all_points)
|
| 160 |
+
|
| 161 |
+
def _initialize_actors(self):
|
| 162 |
+
"""Initialize the actor state."""
|
| 163 |
+
super()._initialize_actors()
|
| 164 |
+
|
| 165 |
+
self._initialize_base_scene_actors()
|
| 166 |
+
if self._object_place_bounds is None:
|
| 167 |
+
# self._discover_table_bounds()
|
| 168 |
+
self._scale_table_bounds(scales=self.table_scale)
|
| 169 |
+
self._initialize_new_scene_actors()
|
| 170 |
+
|
| 171 |
+
def _discover_table_bounds(self):
|
| 172 |
+
"""Discover the bounds of the table."""
|
| 173 |
+
bbox_min, bbox_max = get_axis_aligned_bbox_for_actor(self.ycb_objects['table'])
|
| 174 |
+
self._object_place_bounds = [bbox_min[:2].tolist(), bbox_max[:2].tolist(), [2]]
|
| 175 |
+
|
| 176 |
+
def _scale_table_bounds(self, scales: list[float] = [1.0, 1.0]):
|
| 177 |
+
"""Scale the table bounds by the given factors.
|
| 178 |
+
|
| 179 |
+
Args:
|
| 180 |
+
scales: Scale factors [scale_x, scale_y] for x and y dimensions
|
| 181 |
+
"""
|
| 182 |
+
scale_x, scale_y = scales
|
| 183 |
+
bbox_min, bbox_max = get_axis_aligned_bbox_for_actor(self.ycb_objects['table'])
|
| 184 |
+
center_x = (bbox_max[0] + bbox_min[0]) / 2
|
| 185 |
+
center_y = (bbox_max[1] + bbox_min[1]) / 2
|
| 186 |
+
|
| 187 |
+
half_width = (bbox_max[0] - bbox_min[0]) / 2
|
| 188 |
+
half_length = (bbox_max[1] - bbox_min[1]) / 2
|
| 189 |
+
|
| 190 |
+
scaled_min = [
|
| 191 |
+
center_x - half_width * scale_x,
|
| 192 |
+
center_y - half_length * scale_y
|
| 193 |
+
]
|
| 194 |
+
scaled_max = [
|
| 195 |
+
center_x + half_width * scale_x,
|
| 196 |
+
center_y + half_length * scale_y
|
| 197 |
+
]
|
| 198 |
+
|
| 199 |
+
self._object_place_bounds = [scaled_min, scaled_max, [2]]
|
| 200 |
+
|
| 201 |
+
def _set_env_ycb_obj_attr(self, name, obj):
|
| 202 |
+
setattr(self, f"ycb_object_{name}", obj)
|
| 203 |
+
self.ycb_objects[name] = obj
|
| 204 |
+
|
| 205 |
+
def _set_env_obstacle_obj_attr(self, name, obj):
|
| 206 |
+
setattr(self, f"obstacle_object_{name}", obj)
|
| 207 |
+
self.obstacle_actors[name] = obj
|
| 208 |
+
|
| 209 |
+
def _load_actor_helper(self,
|
| 210 |
+
scene: sapien.Scene,
|
| 211 |
+
scale: float | tuple[float, float, float] | None = None,
|
| 212 |
+
physical_material: sapien.PhysicalMaterial = None,
|
| 213 |
+
density: float | None = None,
|
| 214 |
+
visual_mesh_path: str | None = None,
|
| 215 |
+
collision_mesh_path: str | None = None,
|
| 216 |
+
):
|
| 217 |
+
"""Load an actor from a model ID."""
|
| 218 |
+
builder = scene.create_actor_builder()
|
| 219 |
+
|
| 220 |
+
if isinstance(scale, (int, float)):
|
| 221 |
+
scale = (scale, scale, scale)
|
| 222 |
+
|
| 223 |
+
if visual_mesh_path is not None:
|
| 224 |
+
obj_visual_path = self._get_asset_path(visual_mesh_path)
|
| 225 |
+
builder.add_visual_from_file(
|
| 226 |
+
filename=obj_visual_path,
|
| 227 |
+
scale=scale
|
| 228 |
+
)
|
| 229 |
+
|
| 230 |
+
obj_collision_path = self._get_asset_path(collision_mesh_path)
|
| 231 |
+
builder.add_multiple_collisions_from_file(
|
| 232 |
+
filename=obj_collision_path,
|
| 233 |
+
scale=scale,
|
| 234 |
+
material=physical_material,
|
| 235 |
+
density=density or 1000,
|
| 236 |
+
)
|
| 237 |
+
|
| 238 |
+
return builder
|
| 239 |
+
|
| 240 |
+
def _load_base_scene_actors(self):
|
| 241 |
+
for name, obj_config in self.base_object_configs[OBJECTS_KEY].items():
|
| 242 |
+
builder = self._load_actor_helper(
|
| 243 |
+
scene=self._scene,
|
| 244 |
+
scale = obj_config.get('scale', [1.0]*3),
|
| 245 |
+
visual_mesh_path=obj_config.get('visual', {}).get('path'),
|
| 246 |
+
collision_mesh_path = obj_config.get('collision', {}).get('path'),
|
| 247 |
+
)
|
| 248 |
+
# Build actor as static or dynamic based on config
|
| 249 |
+
if obj_config.get('static', True):
|
| 250 |
+
obj = builder.build_static(name)
|
| 251 |
+
else:
|
| 252 |
+
obj = builder.build(name)
|
| 253 |
+
|
| 254 |
+
# Set these object somewhere far away
|
| 255 |
+
# obj.set_pose(sapien.Pose(OUT_OF_BOUNDS))
|
| 256 |
+
self._set_env_ycb_obj_attr(name, obj)
|
| 257 |
+
|
| 258 |
+
def _load_new_ycb_distractors(self):
|
| 259 |
+
ycb_asset_table = self.model_db['ycb']
|
| 260 |
+
model_keys = list(ycb_asset_table.keys())
|
| 261 |
+
self.new_distractors = [
|
| 262 |
+
str(s)
|
| 263 |
+
for s
|
| 264 |
+
in self._episode_rng.choice(
|
| 265 |
+
model_keys,
|
| 266 |
+
self._distractor_count,
|
| 267 |
+
replace=False
|
| 268 |
+
)
|
| 269 |
+
]
|
| 270 |
+
|
| 271 |
+
for name in self.new_distractors:
|
| 272 |
+
scale=ycb_asset_table[name].get('scale', 1.0)
|
| 273 |
+
visual_mesh_path=ycb_asset_table[name].get('visual_mesh_path')
|
| 274 |
+
collision_mesh_path=ycb_asset_table[name].get('collision_mesh_path')
|
| 275 |
+
builder = self._load_actor_helper(
|
| 276 |
+
scene=self._scene,
|
| 277 |
+
scale=scale,
|
| 278 |
+
visual_mesh_path=visual_mesh_path,
|
| 279 |
+
collision_mesh_path=collision_mesh_path,
|
| 280 |
+
)
|
| 281 |
+
obj = builder.build(name)
|
| 282 |
+
# Set these object somewhere far away
|
| 283 |
+
# obj.set_pose(sapien.Pose(OUT_OF_BOUNDS))
|
| 284 |
+
self._set_env_ycb_obj_attr(name, obj)
|
| 285 |
+
|
| 286 |
+
self._generated_object_configs[OBJECTS_KEY][name].update(
|
| 287 |
+
{
|
| 288 |
+
'visual': {
|
| 289 |
+
'path': visual_mesh_path,
|
| 290 |
+
},
|
| 291 |
+
'collision': {
|
| 292 |
+
'path': collision_mesh_path,
|
| 293 |
+
},
|
| 294 |
+
'scale': scale,
|
| 295 |
+
}
|
| 296 |
+
)
|
| 297 |
+
|
| 298 |
+
def _load_new_obstacles(self):
|
| 299 |
+
obstacle_asset_table = self.model_db['obstacles']
|
| 300 |
+
if obstacle_asset_table is None:
|
| 301 |
+
self.new_obstacles = []
|
| 302 |
+
return
|
| 303 |
+
model_keys = list(obstacle_asset_table.keys())
|
| 304 |
+
self.new_obstacles = [str(s) for s in model_keys]
|
| 305 |
+
|
| 306 |
+
for name in self.new_obstacles:
|
| 307 |
+
# scale = [np.random.uniform(low=0.4, high=0.6),
|
| 308 |
+
# np.random.uniform(low=0.4, high=0.7),
|
| 309 |
+
# np.random.uniform(low=0.6, high=1.1)]
|
| 310 |
+
scale = [np.random.uniform(low=0.3, high=0.5),
|
| 311 |
+
np.random.uniform(low=0.4, high=0.6),
|
| 312 |
+
np.random.uniform(low=0.4, high=0.9)]
|
| 313 |
+
print("scale: ", scale)
|
| 314 |
+
scale=obstacle_asset_table[name].get('scale', scale)
|
| 315 |
+
visual_mesh_path=obstacle_asset_table[name].get('visual_mesh_path')
|
| 316 |
+
collision_mesh_path=obstacle_asset_table[name].get('collision_mesh_path')
|
| 317 |
+
builder = self._load_actor_helper(
|
| 318 |
+
scene=self._scene,
|
| 319 |
+
scale=scale,
|
| 320 |
+
visual_mesh_path=visual_mesh_path,
|
| 321 |
+
collision_mesh_path=collision_mesh_path,
|
| 322 |
+
)
|
| 323 |
+
obj = builder.build(name)
|
| 324 |
+
# Set these object somewhere far away
|
| 325 |
+
# obj.set_pose(sapien.Pose(OUT_OF_BOUNDS))
|
| 326 |
+
# self._set_env_ycb_obj_attr(name, obj)
|
| 327 |
+
self._set_env_obstacle_obj_attr(name, obj)
|
| 328 |
+
|
| 329 |
+
self._generated_object_configs[OBJECTS_KEY][name].update(
|
| 330 |
+
{
|
| 331 |
+
'visual': {
|
| 332 |
+
'path': visual_mesh_path,
|
| 333 |
+
},
|
| 334 |
+
'collision': {
|
| 335 |
+
'path': collision_mesh_path,
|
| 336 |
+
},
|
| 337 |
+
'scale': scale,
|
| 338 |
+
}
|
| 339 |
+
)
|
| 340 |
+
|
| 341 |
+
def _initialize_base_scene_actors(self):
|
| 342 |
+
actors = {a.name: a for a in self.get_actors()}
|
| 343 |
+
|
| 344 |
+
for name, obj_config in self.base_object_configs[OBJECTS_KEY].items():
|
| 345 |
+
obj = actors.get(name)
|
| 346 |
+
assert isinstance(obj, (sapien.Actor, sapien.ActorStatic))
|
| 347 |
+
obj.set_pose(sapien.Pose(
|
| 348 |
+
obj_config['pose']['position'],
|
| 349 |
+
obj_config['pose']['quaternion']
|
| 350 |
+
))
|
| 351 |
+
|
| 352 |
+
def _initialize_new_scene_actors(self):
|
| 353 |
+
"""Set the initial state of the newly generated objects."""
|
| 354 |
+
assert self._object_place_bounds is not None, f"Table bounds must be initialized."
|
| 355 |
+
placed_objects = [
|
| 356 |
+
(actor, ObjectBoundingBox(*(local_bbox_for_actor(actor=actor))))
|
| 357 |
+
for actor
|
| 358 |
+
in [self.ycb_objects[actor_name] for actor_name in self.base_object_configs[OBJECTS_KEY] if actor_name != 'table']
|
| 359 |
+
]
|
| 360 |
+
placement_bounds=PlacementBounds(*self._object_place_bounds)
|
| 361 |
+
|
| 362 |
+
for actor_name in self.new_distractors:
|
| 363 |
+
actor = self.ycb_objects[actor_name]
|
| 364 |
+
actor.set_pose(sapien.Pose([100, 100, -50]))
|
| 365 |
+
|
| 366 |
+
|
| 367 |
+
placed_obstacles = [(actor, ObjectBoundingBox(*(local_bbox_for_actor(actor=actor)))) for actor in self.obstacle_actors.values()]
|
| 368 |
+
for obs_actor_name in self.new_obstacles:
|
| 369 |
+
obs_actor = self.obstacle_actors[obs_actor_name]
|
| 370 |
+
# Generate random yaw angle between -30 and 30 degrees
|
| 371 |
+
yaw = self._episode_rng.uniform(-np.pi/4, np.pi/4)
|
| 372 |
+
# Create quaternion with only yaw rotation
|
| 373 |
+
quat = euler2quat(0, 0, yaw)
|
| 374 |
+
obs_actor.set_pose(sapien.Pose(obs_actor.pose.p, quat))
|
| 375 |
+
bb_min, bb_max = local_bbox_for_actor(actor=obs_actor)
|
| 376 |
+
bbox = ObjectBoundingBox(bb_min, bb_max)
|
| 377 |
+
success = False
|
| 378 |
+
while not success:
|
| 379 |
+
valid_position_2d = find_valid_position_2d(
|
| 380 |
+
placement_bounds=placement_bounds,
|
| 381 |
+
actor=obs_actor,
|
| 382 |
+
actor_local_bbox=bbox,
|
| 383 |
+
placed_objects=placed_obstacles,
|
| 384 |
+
rng=self._episode_rng,
|
| 385 |
+
retries=5000, # worst case
|
| 386 |
+
# minimum_aabb_separation=self._minimum_object_aabb_separation,
|
| 387 |
+
minimum_aabb_separation=0.03,
|
| 388 |
+
)
|
| 389 |
+
z = (- bb_min[2])
|
| 390 |
+
valid_position = np.hstack([valid_position_2d, z])
|
| 391 |
+
print(f"Valid position1: {valid_position}")
|
| 392 |
+
obs_actor.set_pose(sapien.Pose(valid_position, quat))
|
| 393 |
+
self._settle_distractor(distractor_obj=obs_actor, motion_lock_axes=(1, 1, 0, 1, 1, 1))
|
| 394 |
+
if obs_actor.pose.p[2] > 0 and obs_actor.pose.p[2] < 0.4: # if z is unnormal resample it
|
| 395 |
+
success = True
|
| 396 |
+
|
| 397 |
+
for actor_name in self.new_distractors:
|
| 398 |
+
actor = self.ycb_objects[actor_name]
|
| 399 |
+
euler = np.random.uniform(low=-np.pi/2, high=np.pi/2, size=(3,))
|
| 400 |
+
euler = np.multiply(euler, np.array(self.distractor_rotation_axes, dtype=np.int8))
|
| 401 |
+
quat = euler2quat(*euler)
|
| 402 |
+
actor.set_pose(sapien.Pose(actor.pose.p, quat))
|
| 403 |
+
bb_min, bb_max = local_bbox_for_actor(actor=actor)
|
| 404 |
+
bbox = ObjectBoundingBox(bb_min, bb_max)
|
| 405 |
+
valid_position_2d = find_valid_position_2d(
|
| 406 |
+
placement_bounds=placement_bounds,
|
| 407 |
+
actor=actor,
|
| 408 |
+
actor_local_bbox=bbox,
|
| 409 |
+
placed_objects=placed_objects,
|
| 410 |
+
rng=self._episode_rng,
|
| 411 |
+
retries=1000, # worst case
|
| 412 |
+
minimum_aabb_separation=self._minimum_object_aabb_separation,
|
| 413 |
+
)
|
| 414 |
+
ground_level = 0
|
| 415 |
+
# Move up by the min z of the bounding box
|
| 416 |
+
z = ground_level + (- bb_min[2])
|
| 417 |
+
# just be lazy and give a little more height
|
| 418 |
+
z += 0.05
|
| 419 |
+
# If there is less than 0 separation we may want objects to be more likely to stack
|
| 420 |
+
if self._minimum_object_aabb_separation < 0:
|
| 421 |
+
z += 0.3
|
| 422 |
+
# valid_position = self._find_valid_position(placed_objects, distractor_model_id, distractor_model_scale, self._distractor_pos_random, retries=100000)
|
| 423 |
+
if valid_position_2d is None:
|
| 424 |
+
print(f"Warning: Default to placing randomly. Could not find a valid position for distractor {actor_name} after maximum attempts.")
|
| 425 |
+
valid_position_2d = placement_bounds.random_in(rng=self._episode_rng)
|
| 426 |
+
## HACK: add extra height to hopefully stack up
|
| 427 |
+
z += 0.3
|
| 428 |
+
valid_position = np.hstack([valid_position_2d, z])
|
| 429 |
+
# Find a valid position
|
| 430 |
+
actor.set_pose(sapien.Pose(valid_position, actor.pose.q))
|
| 431 |
+
self._settle_distractor(distractor_obj=actor)
|
| 432 |
+
|
| 433 |
+
# get updated AABB
|
| 434 |
+
final_bbox = ObjectBoundingBox(*(local_bbox_for_actor(actor=actor)))
|
| 435 |
+
placed_objects = placed_objects + [(actor, final_bbox)]
|
| 436 |
+
|
| 437 |
+
# Unlock motion
|
| 438 |
+
for actor_name, actor in self.ycb_objects.items():
|
| 439 |
+
if isinstance(actor, sapien.ActorStatic):
|
| 440 |
+
continue
|
| 441 |
+
actor.lock_motion(0, 0, 0, 0, 0, 0)
|
| 442 |
+
actor.set_velocity(np.zeros(3))
|
| 443 |
+
actor.set_angular_velocity(np.zeros(3))
|
| 444 |
+
self._settle(0.5)
|
| 445 |
+
|
| 446 |
+
lin_vel, ang_vel = 0.0, 0.0
|
| 447 |
+
for actor_name, actor in self.ycb_objects.items():
|
| 448 |
+
if isinstance(actor, sapien.ActorStatic):
|
| 449 |
+
continue
|
| 450 |
+
lin_vel += np.linalg.norm(actor.velocity)
|
| 451 |
+
ang_vel += np.linalg.norm(actor.angular_velocity)
|
| 452 |
+
if lin_vel > 1e-3 or ang_vel > 1e-2:
|
| 453 |
+
self._settle(1.5)
|
| 454 |
+
|
| 455 |
+
for obs_actor_name in self.new_obstacles:
|
| 456 |
+
obs_actor = self.obstacle_actors[obs_actor_name]
|
| 457 |
+
print("pose at the end: ", obs_actor.pose)
|
| 458 |
+
|
| 459 |
+
|
| 460 |
+
def _serialize_actors(self) -> dict:
|
| 461 |
+
"""Serialize the actors to a hierarchy.
|
| 462 |
+
|
| 463 |
+
This is useful for saving and loading the scene state. Example:
|
| 464 |
+
```yaml
|
| 465 |
+
# yaml
|
| 466 |
+
objects:
|
| 467 |
+
- name: table
|
| 468 |
+
visual:
|
| 469 |
+
path: object/table/desktable.glb
|
| 470 |
+
collision:
|
| 471 |
+
path: "object/table/desktable.obj" # same as visual in this case
|
| 472 |
+
scale: [2.0, 1.0, 1.5]
|
| 473 |
+
pose:
|
| 474 |
+
position: [0.4, 0, -0.75]
|
| 475 |
+
quaternion: [0, 0, 0.7071068, 0.7071068]
|
| 476 |
+
```
|
| 477 |
+
"""
|
| 478 |
+
actors_dict = self._generated_object_configs.copy()
|
| 479 |
+
for actor_name, actor in self.ycb_objects.items():
|
| 480 |
+
actors_dict[OBJECTS_KEY][actor_name].update({
|
| 481 |
+
|
| 482 |
+
'pose': {
|
| 483 |
+
'position': actor.pose.p.tolist(),
|
| 484 |
+
'quaternion': actor.pose.q.tolist(),
|
| 485 |
+
}
|
| 486 |
+
})
|
| 487 |
+
|
| 488 |
+
for obstacle_name, obstacle in self.obstacle_actors.items():
|
| 489 |
+
actors_dict[OBJECTS_KEY][obstacle_name].update({
|
| 490 |
+
'pose': {
|
| 491 |
+
'position': obstacle.pose.p.tolist(),
|
| 492 |
+
'quaternion': obstacle.pose.q.tolist(),
|
| 493 |
+
}
|
| 494 |
+
})
|
| 495 |
+
# convert back to list version
|
| 496 |
+
actors_dict[OBJECTS_KEY] = _list_hierarchy_dict(actors_dict[OBJECTS_KEY])
|
| 497 |
+
|
| 498 |
+
return self.scene_serializer_func(actors_dict)
|
| 499 |
+
|
| 500 |
+
|
| 501 |
+
def reset(self, seed=None, options=None):
|
| 502 |
+
obs, info = super().reset(seed, options)
|
| 503 |
+
info['scene_config'] = self._serialize_actors()
|
| 504 |
+
return obs, info
|
| 505 |
+
|
| 506 |
+
def _settle_distractor(
|
| 507 |
+
self,
|
| 508 |
+
distractor_obj: sapien.Actor,
|
| 509 |
+
motion_lock_axes=(1, 1, 0, 0, 0, 0),
|
| 510 |
+
):
|
| 511 |
+
return settle_distractor(
|
| 512 |
+
env=self,
|
| 513 |
+
distractor_obj=distractor_obj,
|
| 514 |
+
t=0.5,
|
| 515 |
+
drop_height=0.5,
|
| 516 |
+
unlock_at_end=False,
|
| 517 |
+
motion_lock_axes=motion_lock_axes,
|
| 518 |
+
)
|
| 519 |
+
|
| 520 |
+
def _initialize_agent(self):
|
| 521 |
+
"""Higher EE pos."""
|
| 522 |
+
qpos = np.array(
|
| 523 |
+
[0.0, 0, 0, -np.pi * 2 / 3, 0, np.pi * 2 / 3, np.pi / 4, 0.04, 0.04]
|
| 524 |
+
)
|
| 525 |
+
# fmt: on
|
| 526 |
+
qpos[:-2] += self._episode_rng.normal(
|
| 527 |
+
0, self.robot_init_qpos_noise, len(qpos) - 2
|
| 528 |
+
)
|
| 529 |
+
self.agent.reset(qpos)
|
| 530 |
+
self.agent.robot.set_pose(Pose([0, 0, 0]))
|
| 531 |
+
#make the robot invisible
|
| 532 |
+
for actor in self.agent.robot.get_links():
|
| 533 |
+
actor.hide_visual()
|
| 534 |
+
|
| 535 |
+
def _register_render_cameras(self):
|
| 536 |
+
if self.robot_uid == "panda":
|
| 537 |
+
# pose = look_at([1.3, 0.4, 0.8], [0.0, 0.0, 0.4])
|
| 538 |
+
# pose = look_at([-0.2, 0.0, 1.5], [0.4, 0.0, 0.0])# Top-down view
|
| 539 |
+
pose = look_at([2.0, 0.5, 0.6], [0, -0.1, 0.2]) #side view
|
| 540 |
+
return CameraConfig("render_camera", pose.p, pose.q, 1024, 1024, 1, 0.01, 10)
|
| 541 |
+
|
| 542 |
+
def _list_hierarchy_dict(dict_obj: dict):
|
| 543 |
+
return [{'name': k, **v} for k, v in dict_obj.items() if isinstance(v, dict)]
|
| 544 |
+
|
| 545 |
+
def _key_hierarchy_dict(list_obj: list, on_key: str = 'name'):
|
| 546 |
+
return {v[on_key]: v for v in list_obj if v.get(on_key) is not None}
|
| 547 |
+
|
| 548 |
+
|
| 549 |
+
def settle_distractor(
|
| 550 |
+
env: BaseEnv,
|
| 551 |
+
distractor_obj: sapien.Actor,
|
| 552 |
+
t: float,
|
| 553 |
+
drop_height: float = 0.5,
|
| 554 |
+
unlock_at_end: bool = False,
|
| 555 |
+
motion_lock_axes: tuple[int, int, int, int, int, int] = (1, 1, 0, 1, 1, 0),
|
| 556 |
+
up: np.ndarray = np.array([0., 0., 1.]),
|
| 557 |
+
):
|
| 558 |
+
drop = up * drop_height
|
| 559 |
+
distractor_obj.set_pose(sapien.Pose(distractor_obj.pose.p + drop, distractor_obj.pose.q))
|
| 560 |
+
distractor_obj.set_velocity(np.zeros(3))
|
| 561 |
+
distractor_obj.set_angular_velocity(np.zeros(3))
|
| 562 |
+
# Lock x and y and pitch and roll
|
| 563 |
+
assert len(motion_lock_axes) == 6, f"`{motion_lock_axes=}` must be a tuple of length 6"
|
| 564 |
+
distractor_obj.lock_motion(*motion_lock_axes)
|
| 565 |
+
|
| 566 |
+
# Let distractor objects fall onto the table
|
| 567 |
+
settle(env, t)
|
| 568 |
+
|
| 569 |
+
if unlock_at_end:
|
| 570 |
+
distractor_obj.lock_motion(*[0]*6)
|
| 571 |
+
|
| 572 |
+
|
| 573 |
+
def settle(env: BaseEnv, t):
|
| 574 |
+
# step the simulation and let the scene settle for t seconds
|
| 575 |
+
sim_steps = int(env.sim_freq * t)
|
| 576 |
+
for _ in range(sim_steps):
|
| 577 |
+
env._scene.step()
|
| 578 |
+
|
| 579 |
+
def local_bbox_for_actor(actor: sapien.Actor) -> tuple[np.ndarray, np.ndarray]:
|
| 580 |
+
mins, maxs = get_axis_aligned_bbox_for_actor(actor)
|
| 581 |
+
mins -= actor.pose.p
|
| 582 |
+
maxs -= actor.pose.p
|
| 583 |
+
return mins, maxs
|
project/ManiSkill3/src/maniskill3_environment/docs/source/_static/env_thumbnails/PickClutterYCB-v1_rt_thumb_first.png
ADDED
|
|
Git LFS Details
|
project/ManiSkill3/src/maniskill3_environment/docs/source/_static/env_thumbnails/PickClutterYCB-v1_rt_thumb_last.png
ADDED
|
|
Git LFS Details
|
project/ManiSkill3/src/maniskill3_environment/docs/source/_static/env_thumbnails/PickSingleYCB-v1_rt_thumb_last.png
ADDED
|
|
Git LFS Details
|
project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/AnymalC-Reach-v1_rt.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:696f4c0ae90a56d0edecfba6bcecdf4ff0e06ef5888920a221cd5d8446e46301
|
| 3 |
+
size 56992
|
project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/AnymalC-Spin-v1_rt.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1583ad114c6956c901acaddcc2a59a85e99e6089005942fbfa9a6e52802c55b7
|
| 3 |
+
size 440488
|
project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/AssemblingKits-v1_rt.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c85dc660adcc569e80c35dee229991984ac4b97b1f41ca106f082140ec1c28f5
|
| 3 |
+
size 207136
|
project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/FMBAssembly1Easy.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4b2cbca524b9acd618a554273c1335612ef795939a57b977e9ca422104dc1272
|
| 3 |
+
size 1175013
|
project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/LiftPegUpright-v1_rt.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:31b1f1fd90966c26b23e7b21228bd4e0c341d4b51e4e3d62786217c86123fcec
|
| 3 |
+
size 269267
|
project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/MS-CartpoleBalance-v1_rt.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:298d70c05e3f5fff86ec804e101ab6e237ec194c299a62b9ca3898a50635d8b0
|
| 3 |
+
size 27453
|
project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/ManiSkill-HAB_rt.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fd51f313f1e6e8d3ffdf07a5c76b6c702424b18ed880825c546842185de1035a
|
| 3 |
+
size 2121211
|
project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/OpenCabinetDrawer-v1_rt.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ca5ff1da6430b9eec2b0d7c749a73392d60df7ad2cdfa99190d0730e265bd564
|
| 3 |
+
size 43081
|
project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/PegInsertionSide-v1_rt.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:eeeda0cf62b7888c34b49707c3980408ad8f9bbb038930419337925b0251dd37
|
| 3 |
+
size 125420
|
project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/PickClutterYCB-v1_rt.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:447e1bb757c05969406446094fd87f1e7129c4fa8ed5dcaf3471d6f4f9db5371
|
| 3 |
+
size 131551
|
project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/PickCube-v1_rt.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5f3e4ffbcd759ca274e632a1cce600d63a650a57f5985fde9272a1d5c1a40acc
|
| 3 |
+
size 77049
|
project/ManiSkill3/src/maniskill3_environment/figures/environment_demos/PickSingleYCB-v1_rt.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2adf6c3e2d137bb60559f549d58cc94e0210010b9bdc4c1afcd37a7e8e84f60e
|
| 3 |
+
size 165740
|