From 5c09f433075fccc3c2499667a0cd5f035feed782 Mon Sep 17 00:00:00 2001 From: Gao Hanxiang Date: Mon, 12 Jul 2021 02:11:15 -0400 Subject: [PATCH] style: Move static_path into skyline_console 1. Move static_path into skyline_console to facilitate other modules to import. 2. Rename make build to make package Change-Id: I7c9c5873f90b80de1203e9a38cf0ee5cc68fc42b --- .dockerignore | 13 ------------- Makefile | 21 +++++++++++++++------ package.json | 2 +- poetry.toml | 2 ++ skyline_console/__init__.py | 4 ++++ skyline_console/__main__.py | 5 +---- skyline_console/py.typed | 0 7 files changed, 23 insertions(+), 24 deletions(-) delete mode 100644 .dockerignore create mode 100644 poetry.toml create mode 100644 skyline_console/py.typed diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 79187b2d..00000000 --- a/.dockerignore +++ /dev/null @@ -1,13 +0,0 @@ -npm-debug.log -yarn-error.log -node_modules -package-lock.json - -.git/ -.idea/ -.vscode/ -run/ - -.DS_Store -*.sw* -*.un~ \ No newline at end of file diff --git a/Makefile b/Makefile index 754c9e71..7bb89cd0 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,10 @@ GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) GIT_COMMIT ?= $(shell git rev-parse --verify HEAD) +.PHONY: all +all: install fmt lint test package + + .PHONY: help help: @echo "Skyline console development makefile" @@ -31,7 +35,7 @@ help: @echo "Target:" @echo " git_config Initialize git configuration." @echo " install Installs the project dependencies." - @echo " build Build source and wheel packages." + @echo " package Build package from source code." @echo " lint Check JavaScript code." @echo " test Run unit tests." @echo @@ -66,18 +70,23 @@ install: yarn install -.PHONY: build -build: +.PHONY: package +package: install rm -rf $(ROOT_DIR)/skyline_console/static yarn run build - poetry build + poetry build -f wheel + + +.PHONY: fmt +fmt: + # yarn run lint-staged .PHONY: lint lint: - yarn run lint + # yarn run lint .PHONY: test test: - yarn run test:unit + # yarn run test:unit diff --git a/package.json b/package.json index 919f5901..7dda56c7 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "description": "", "author": "OpenStack ", - "license": "Apache 2.0", + "license": "Apache-2.0", "scripts": { "mock": "webpack-dev-server --open --config config/webpack.dev.js", "dev": "cross-env NODE_ENV=development webpack-dev-server --open --config config/webpack.dev.js --env.API=dev", diff --git a/poetry.toml b/poetry.toml new file mode 100644 index 00000000..ab1033bd --- /dev/null +++ b/poetry.toml @@ -0,0 +1,2 @@ +[virtualenvs] +in-project = true diff --git a/skyline_console/__init__.py b/skyline_console/__init__.py index 3dc1f76b..a54ae431 100644 --- a/skyline_console/__init__.py +++ b/skyline_console/__init__.py @@ -1 +1,5 @@ +from pathlib import Path + __version__ = "0.1.0" + +static_path = Path(__file__).parent.joinpath("static") diff --git a/skyline_console/__main__.py b/skyline_console/__main__.py index 9bbb058c..bc44cd96 100644 --- a/skyline_console/__main__.py +++ b/skyline_console/__main__.py @@ -1,9 +1,6 @@ import sys -from pathlib import Path -import skyline_console - -static_path = Path(skyline_console.__file__).parent.joinpath("static") +from skyline_console import static_path if static_path.joinpath("index.html").exists(): print(f'Static resource directory of "skyline-console" is:\n{str(static_path)}') diff --git a/skyline_console/py.typed b/skyline_console/py.typed new file mode 100644 index 00000000..e69de29b