mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-11 13:44:16 +00:00
virtualenv use
This commit is contained in:
20
docs/installation.md
vendored
20
docs/installation.md
vendored
@@ -1,6 +1,8 @@
|
|||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
* [As a submodule](#as-a-submodule)
|
* [As a submodule](#as-a-submodule)
|
||||||
|
* [As a submodule in a virtualenv](#as-a-submodule-in-a-virtualenv)
|
||||||
|
* [Submodule upgrade/downgrade](#submodule-upgradedowngrade)
|
||||||
* [PyPI package](#pypi-package)
|
* [PyPI package](#pypi-package)
|
||||||
* [Homebrew package](#homebrew-package)
|
* [Homebrew package](#homebrew-package)
|
||||||
* [Debian unstable (sid)](#debian)
|
* [Debian unstable (sid)](#debian)
|
||||||
@@ -54,7 +56,7 @@ shell with the config file path; for example:
|
|||||||
alias dotdrop=<absolute-path-to-dotdrop.sh> --cfg=<path-to-your-config.yaml>'
|
alias dotdrop=<absolute-path-to-dotdrop.sh> --cfg=<path-to-your-config.yaml>'
|
||||||
```
|
```
|
||||||
|
|
||||||
### As a submodule in a virtualenv
|
## As a submodule in a virtualenv
|
||||||
|
|
||||||
To install it in a [virtualenv](https://virtualenv.pypa.io):
|
To install it in a [virtualenv](https://virtualenv.pypa.io):
|
||||||
```bash
|
```bash
|
||||||
@@ -65,23 +67,29 @@ $ git init
|
|||||||
## install dotdrop as a submodule
|
## install dotdrop as a submodule
|
||||||
$ git submodule add https://github.com/deadc0de6/dotdrop.git
|
$ git submodule add https://github.com/deadc0de6/dotdrop.git
|
||||||
$ virtualenv -p python3 env
|
$ virtualenv -p python3 env
|
||||||
$ echo 'env' > .gitignore
|
$ echo 'env' >> .gitignore
|
||||||
$ source env/bin/activate
|
$ env/bin/pip install -r dotdrop/requirements.txt
|
||||||
$ pip install -r dotdrop/requirements.txt
|
|
||||||
$ ./dotdrop/bootstrap.sh
|
$ ./dotdrop/bootstrap.sh
|
||||||
|
|
||||||
|
# add the following in your .bashrc/.zshrc/etc
|
||||||
|
# or hardcode it in the dotdrop.sh script
|
||||||
|
$ export DOTDROP_VIRTUALENV=env
|
||||||
|
|
||||||
## use dotdrop
|
## use dotdrop
|
||||||
$ ./dotdrop.sh --help
|
$ ./dotdrop.sh --help
|
||||||
```
|
```
|
||||||
|
|
||||||
When using a virtualenv, make sure to source the environment before using dotdrop:
|
When using a virtualenv, make sure to export the `DOTDROP_VIRTUALENV`
|
||||||
|
variable with the directory name of your virtualenv:
|
||||||
```bash
|
```bash
|
||||||
$ source env/bin/activate
|
$ export DOTDROP_VIRTUALENV=env
|
||||||
$ ./dotdrop.sh --help
|
$ ./dotdrop.sh --help
|
||||||
```
|
```
|
||||||
|
|
||||||
Then follow the instructions under [As a submodule](#as-a-submodule).
|
Then follow the instructions under [As a submodule](#as-a-submodule).
|
||||||
|
|
||||||
|
## Submodule upgrade/downgrade
|
||||||
|
|
||||||
### Upgrade dotdrop submodule
|
### Upgrade dotdrop submodule
|
||||||
|
|
||||||
If using dotdrop as a submodule, one can control if dotdrop
|
If using dotdrop as a submodule, one can control if dotdrop
|
||||||
|
|||||||
12
dotdrop.sh
vendored
12
dotdrop.sh
vendored
@@ -2,6 +2,8 @@
|
|||||||
# author: deadc0de6 (https://github.com/deadc0de6)
|
# author: deadc0de6 (https://github.com/deadc0de6)
|
||||||
# Copyright (c) 2017, deadc0de6
|
# Copyright (c) 2017, deadc0de6
|
||||||
|
|
||||||
|
ENV_DIR=${DOTDROP_VIRTUALENV:-}
|
||||||
|
|
||||||
# setup variables
|
# setup variables
|
||||||
args=("$@")
|
args=("$@")
|
||||||
cur=$(cd "$(dirname "${0}")" && pwd)
|
cur=$(cd "$(dirname "${0}")" && pwd)
|
||||||
@@ -18,8 +20,14 @@ fi
|
|||||||
|
|
||||||
# check python executable
|
# check python executable
|
||||||
pybin="python3"
|
pybin="python3"
|
||||||
hash ${pybin} 2>/dev/null || pybin="python"
|
if [ -z "${ENV_DIR}" ]; then
|
||||||
[[ "$(${pybin} -V 2>&1)" =~ "Python 3" ]] || { echo "install Python 3" && exit 1; }
|
hash ${pybin} 2>/dev/null || pybin="python"
|
||||||
|
[[ "$(${pybin} -V 2>&1)" =~ "Python 3" ]] || { echo "install Python 3" && exit 1; }
|
||||||
|
else
|
||||||
|
# virtualenv
|
||||||
|
pybin="${ENV_DIR}/bin/python"
|
||||||
|
fi
|
||||||
|
hash "${pybin}" 2>/dev/null || (echo "python executable not found" && exit 1)
|
||||||
|
|
||||||
# launch dotdrop
|
# launch dotdrop
|
||||||
PYTHONPATH=dotdrop:${PYTHONPATH} ${pybin} -m dotdrop.dotdrop "${args[@]}"
|
PYTHONPATH=dotdrop:${PYTHONPATH} ${pybin} -m dotdrop.dotdrop "${args[@]}"
|
||||||
|
|||||||
Reference in New Issue
Block a user