Skip to content

Commit

Permalink
rename: Rename project and files.
Browse files Browse the repository at this point in the history
  • Loading branch information
innerNULL committed Dec 21, 2021
1 parent 3cefaeb commit 1bd8a69
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 45 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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
```


Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion files/centos_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion files/ubuntu_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"docker": {
"base_img": "ubuntu:20.04",
"build_img": "ubuntu_py",
"container": "pylocatable_container"
"container": "pypack_container"
},
"python": {
"version": "3.9",
Expand Down
29 changes: 0 additions & 29 deletions pylocatable.sh

This file was deleted.

10 changes: 5 additions & 5 deletions pack.py → pypack.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand Down
29 changes: 29 additions & 0 deletions pypack.sh
Original file line number Diff line number Diff line change
@@ -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


File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pylocatable/templates.py → pypack/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

DOCKERFILE_TEMP: str = """
FROM {img}
MAINTAINER "pylocatable@github"
MAINTAINER "pypack@github"
RUN mkdir /workspace
WORKDIR /workspace
Expand Down
File renamed without changes.

0 comments on commit 1bd8a69

Please sign in to comment.