-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add an openbb-build script to openbb-core package * import outside of top level * use echo instead of print --------- Co-authored-by: Igor Radovanovic <[email protected]>
- Loading branch information
1 parent
12f1199
commit c697f55
Showing
3 changed files
with
518 additions
and
453 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"""Script to build the OpenBB platform static assets.""" | ||
|
||
# flake8: noqa: S603 | ||
# pylint: disable=import-outside-toplevel | ||
|
||
import subprocess | ||
import sys | ||
|
||
|
||
def main(): | ||
"""Build the OpenBB platform static assets.""" | ||
try: | ||
from openbb import build | ||
|
||
build() | ||
except ( | ||
ImportError, | ||
ModuleNotFoundError, | ||
AttributeError, | ||
) as e: | ||
subprocess.run( | ||
["/bin/echo", "\nOpenBB build script not found, installing from PyPI...\n"], | ||
check=True, | ||
) | ||
subprocess.run( | ||
[sys.executable, "-m", "pip", "install", "openbb", "--no-deps"], | ||
check=True, | ||
) | ||
try: | ||
subprocess.run( | ||
[sys.executable, "-c", "import openbb; openbb.build()"], | ||
check=True, | ||
) | ||
except (subprocess.CalledProcessError, AttributeError): | ||
raise RuntimeError( | ||
"Failed to find the OpenBB build script. Install with `pip install openbb --no-deps`" | ||
) from e | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.