# Copyright 2022 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Install script for MuJoCo.""" import fnmatch import logging import os import platform import random import re import shutil import string import subprocess import sys import sysconfig import setuptools from setuptools.command import build_ext from setuptools.command import install_scripts MUJOCO_CMAKE = 'MUJOCO_CMAKE' MUJOCO_CMAKE_ARGS = 'MUJOCO_CMAKE_ARGS' MUJOCO_PATH = 'MUJOCO_PATH' MUJOCO_PLUGIN_PATH = 'MUJOCO_PLUGIN_PATH' EXT_PREFIX = 'mujoco.' def get_long_description(): """Creates a long description for the package from bundled markdown files.""" current_dir = os.path.dirname('__file__') with open(os.path.join(current_dir, 'README.md')) as f: description = f.read() try: with open(os.path.join(current_dir, 'LICENSES_THIRD_PARTY.md')) as f: description = f'{description}\n{f.read()}' except FileNotFoundError: pass return description def get_mujoco_lib_pattern(): if platform.system() == 'Windows': return 'mujoco.lib' elif platform.system() == 'Darwin': return 'libmujoco.*.dylib' else: return 'libmujoco.so.*' def get_external_lib_patterns(): if platform.system() == 'Windows': return ['mujoco.dll'] elif platform.system() == 'Darwin': return ['libmujoco.*.dylib'] else: return ['libmujoco.so.*'] def get_plugin_lib_patterns(): if platform.system() == 'Windows': return ['*.dll'] elif platform.system() == 'Darwin': return ['lib*.dylib'] else: return ['lib*'] def start_and_end(iterable): it = iter(iterable) while True: try: first = next(it) second = next(it) yield first, second except StopIteration: return def tokenize_quoted_substr(input_string, quote_char, placeholders=None): """Replace quoted substrings with random text placeholders with no spaces.""" # Matches quote characters not proceded with a backslash. pattern = re.compile(r'(?