-
Notifications
You must be signed in to change notification settings - Fork 6
/
prepare.py
33 lines (22 loc) · 967 Bytes
/
prepare.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import sys
if not sys.version_info >= (3, 6, 0):
raise Exception("Autorest for Python extension requires Python 3.6 at least")
from pathlib import Path
import venv
from venvtools import python_run
_ROOT_DIR = Path(__file__).parent
def main():
venv_path = _ROOT_DIR / "venv"
venv_prexists = venv_path.exists()
assert venv_prexists # Otherwise install was not done
env_builder = venv.EnvBuilder(with_pip=True)
venv_context = env_builder.ensure_directories(venv_path)
python_run(venv_context, "pip", "install -r {}".format(_ROOT_DIR / 'dev_requirements.txt'))
if __name__ == "__main__":
main()