diff --git a/README.md b/README.md index de5d6e2..507071f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# pylocatable -makes PYthon environment reLOCATABLE. +# pypack +makes PYthon environment PACKageable. -By running `pack.py` or `pylocatable.sh`, you can get a locatable to anywhere python environment tar.gz file. You can control which kind python environment you want by customize your config file. +By running `pypack.py` or `pypack.sh`, you can get a locatable to anywhere python environment tar.gz file. You can control which kind python environment you want by customize your config file. BTW, don't worry this will mess your current directory up, since all files and all operations will be handled or executed under `build.path` defined by config file. @@ -16,17 +16,17 @@ BTW, don't worry this will mess your current directory up, since all files and a ## How to Run? Using demo config file and requirements.txt file located at `./files` as example, run ```bash -python pack.py --conf_path ./files/centos_config.json +python pypack.py --conf_path ./files/centos_config.json # or -python pack.py --conf_path ./files/ubuntu_config.json +python pypack.py --conf_path ./files/ubuntu_config.json ``` After execution, the last line of logs will tell you where to get your python-env tar.gz file. If you do not want `git clone` the responsitory, you can just run ```bash -curl -s https://raw.githubusercontent.com/innerNULL/pylocatable/main/pylocatable.sh | bash /dev/stdin path/to/config.json +curl -s https://raw.githubusercontent.com/innerNULL/pypack/main/pypack.sh | bash /dev/stdin path/to/config.json # or (in China Mainland) -curl -s https://ghproxy.com/https://raw.githubusercontent.com/innerNULL/pylocatable/main/pylocatable.sh | bash /dev/stdin path/to/config.json +curl -s https://ghproxy.com/https://raw.githubusercontent.com/innerNULL/pypack/main/pypack.sh | bash /dev/stdin path/to/config.json ``` @@ -39,7 +39,7 @@ curl -s https://ghproxy.com/https://raw.githubusercontent.com/innerNULL/pylocata * **python**: * **version**: Target python environment version. * **env_name**: Target python environment name. - * **dep**: Target python environment's dependencies packages, which is, `requirement.txt` path. Note, no matter you use `pack.py` or `pylocatable.sh`, this path should be an absolute path or **a relative path refer to your current path (the path you execute packaging command)**. + * **dep**: Target python environment's dependencies packages, which is, `requirement.txt` path. Note, no matter you use `pack.py` or `pypack.sh`, this path should be an absolute path or **a relative path refer to your current path (the path you execute packaging command)**. * **post_running**: The command should be executed after `pip install`. * **build**: * **path**: The directroy under which to execute building target python environment. This should be a new path. diff --git a/files/centos_config.json b/files/centos_config.json index 1ab8370..a4ea12d 100644 --- a/files/centos_config.json +++ b/files/centos_config.json @@ -3,7 +3,7 @@ "docker": { "base_img": "centos:centos7.3.1611", "build_img": "centos_py", - "container": "pylocatable_container" + "container": "pypack_container" }, "python": { "version": "3.7", diff --git a/files/ubuntu_config.json b/files/ubuntu_config.json index b694ace..100041b 100644 --- a/files/ubuntu_config.json +++ b/files/ubuntu_config.json @@ -3,7 +3,7 @@ "docker": { "base_img": "ubuntu:20.04", "build_img": "ubuntu_py", - "container": "pylocatable_container" + "container": "pypack_container" }, "python": { "version": "3.9", diff --git a/pylocatable.sh b/pylocatable.sh deleted file mode 100644 index 3cace82..0000000 --- a/pylocatable.sh +++ /dev/null @@ -1,29 +0,0 @@ -# file: pylocatable.sh - - -set -x - - -CONF_PATH=$1 - -CURR_PATH=$(pwd) -WORK_DIR="./_pylocatable" -WORK_ABS_DIR=$(cd "$(dirname "${WORK_DIR}")"; pwd)/$(basename "${WORK_DIR}") - - -function get_pylocatable() { - mkdir -p ${WORK_DIR} - cd ${WORK_DIR} && git clone git@github.com:innerNULL/pylocatable.git -} - -function main() { - get_pylocatable - cd ${CURR_PATH} - python3 ${WORK_DIR}/pylocatable/pack.py --conf_path ${CONF_PATH} - rm -rf ${WORK_DIR} -} - - -main - - diff --git a/pack.py b/pypack.py similarity index 77% rename from pack.py rename to pypack.py index fb8c364..960b5fd 100644 --- a/pack.py +++ b/pypack.py @@ -5,10 +5,10 @@ import argparse from typing import Dict, List, Union -import pylocatable as ploc -import pylocatable.ops as ops -import pylocatable.utils as utils -import pylocatable.templates as templates +import pypack as pypack +import pypack.ops as ops +import pypack.utils as utils +import pypack.templates as templates argparser = argparse.ArgumentParser() @@ -22,7 +22,7 @@ print("Starting python-env packing process...") conf_path: str = args.conf_path - config: ploc.Config = ploc.Config(conf_path) + config: pypack.Config = pypack.Config(conf_path) ops.predownload(config) ops.files_relocate(config) ops.dockerfile_build(config) diff --git a/pypack.sh b/pypack.sh new file mode 100644 index 0000000..acd4d48 --- /dev/null +++ b/pypack.sh @@ -0,0 +1,29 @@ +# file: pypack.sh + + +set -x + + +CONF_PATH=$1 + +CURR_PATH=$(pwd) +WORK_DIR="./_pypack" +WORK_ABS_DIR=$(cd "$(dirname "${WORK_DIR}")"; pwd)/$(basename "${WORK_DIR}") + + +function get_pypack() { + mkdir -p ${WORK_DIR} + cd ${WORK_DIR} && git clone git@github.com:innerNULL/pypack.git +} + +function main() { + get_pypack + cd ${CURR_PATH} + python3 ${WORK_DIR}/pypack/pypack.py --conf_path ${CONF_PATH} + rm -rf ${WORK_DIR} +} + + +main + + diff --git a/pylocatable/__init__.py b/pypack/__init__.py similarity index 100% rename from pylocatable/__init__.py rename to pypack/__init__.py diff --git a/pylocatable/ops.py b/pypack/ops.py similarity index 100% rename from pylocatable/ops.py rename to pypack/ops.py diff --git a/pylocatable/templates.py b/pypack/templates.py similarity index 95% rename from pylocatable/templates.py rename to pypack/templates.py index 0bca244..4183f09 100644 --- a/pylocatable/templates.py +++ b/pypack/templates.py @@ -4,7 +4,7 @@ DOCKERFILE_TEMP: str = """ FROM {img} -MAINTAINER "pylocatable@github" +MAINTAINER "pypack@github" RUN mkdir /workspace WORKDIR /workspace diff --git a/pylocatable/utils.py b/pypack/utils.py similarity index 100% rename from pylocatable/utils.py rename to pypack/utils.py