mirror of
https://github.com/halo-re/halo.git
synced 2024-11-26 23:20:22 +00:00
tools: Check project requirements
This commit is contained in:
parent
69607f62d2
commit
21bc641df6
@ -1,3 +1,3 @@
|
||||
libclang
|
||||
pefile
|
||||
pyxbe
|
||||
libclang~=16.0.0
|
||||
pefile~=2023.2.7
|
||||
pyxbe~=1.0.2
|
||||
|
33
tools/check_requirements.py
Normal file
33
tools/check_requirements.py
Normal file
@ -0,0 +1,33 @@
|
||||
from pathlib import Path
|
||||
import logging
|
||||
|
||||
import pkg_resources
|
||||
|
||||
import color
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def check_requirements() -> None:
|
||||
requirements_path = Path(__file__).parent.with_name("requirements.txt")
|
||||
|
||||
with open(requirements_path, "r", encoding="utf-8") as f:
|
||||
requirements = f.readlines()
|
||||
|
||||
try:
|
||||
pkg_resources.require(requirements)
|
||||
except pkg_resources.DistributionNotFound as e:
|
||||
log.error("Required package '%s' is not installed. Please install project requirements via requirements.txt.", e.req)
|
||||
exit(1)
|
||||
except pkg_resources.VersionConflict as e:
|
||||
log.error("There is a package version conflict. '%s' is installed, but '%s' is required. Please install project requirements via requirements.txt.", e.dist, e.req)
|
||||
exit(1)
|
||||
|
||||
|
||||
def main():
|
||||
check_requirements()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logging.basicConfig(level=logging.INFO, handlers=[color.ColorLogHandler()])
|
||||
main()
|
@ -1,4 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
if __name__ == "__main__":
|
||||
from check_requirements import check_requirements
|
||||
check_requirements()
|
||||
|
||||
import json
|
||||
from collections import defaultdict
|
||||
from typing import Sequence, Union, Optional
|
||||
|
@ -1,4 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
if __name__ == "__main__":
|
||||
from check_requirements import check_requirements
|
||||
check_requirements()
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import os
|
||||
|
@ -1,4 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
if __name__ == "__main__":
|
||||
from check_requirements import check_requirements
|
||||
check_requirements()
|
||||
|
||||
import itertools
|
||||
import struct
|
||||
import subprocess
|
||||
|
Loading…
Reference in New Issue
Block a user