summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2020-11-20 09:26:40 +0100
committerAnton Khirnov <anton@khirnov.net>2020-11-20 09:29:56 +0100
commitf55a44acf4c65e6e7534813b09f9b5b50e5796a6 (patch)
tree9bf6759d1a837631e88ea9b22c4c6c7de3c7075e /bin
parent38c78bd3c33068902347208bb15ad49b65570e9c (diff)
Include pyaml directly, not as a submodule.
Its repository is quite big and contains infrastructure we do not need. We should not need to update it, so just include the source directly. Also, simplify bin/dotbot.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/dotbot43
1 files changed, 5 insertions, 38 deletions
diff --git a/bin/dotbot b/bin/dotbot
index 6232a50..3e57ea6 100755
--- a/bin/dotbot
+++ b/bin/dotbot
@@ -1,45 +1,12 @@
-#!/usr/bin/env sh
+#!/usr/bin/python3
-# This is a valid shell script and also a valid Python script. When this file
-# is executed as a shell script, it finds a python binary and executes this
-# file as a Python script, passing along all of the command line arguments.
-# When this file is executed as a Python script, it loads and runs Dotbot. This
-# is useful because we don't know the name of the python binary.
-
-''':' # begin python string; this line is interpreted by the shell as `:`
-command -v python >/dev/null 2>&1 && exec python "$0" "$@"
-command -v python3 >/dev/null 2>&1 && exec python3 "$0" "$@"
-command -v python2 >/dev/null 2>&1 && exec python2 "$0" "$@"
->&2 echo "error: cannot find python"
-exit 1
-'''
-
-# python code
-
-import sys, os
+import os
+import sys
PROJECT_ROOT_DIRECTORY = os.path.dirname(
os.path.dirname(os.path.realpath(__file__)))
-
-def inject(lib_path):
- path = os.path.join(PROJECT_ROOT_DIRECTORY, 'lib', lib_path)
- sys.path.insert(0, path)
-
-# version dependent libraries
-if sys.version_info[0] >= 3:
- inject('pyyaml/lib3')
-else:
- inject('pyyaml/lib')
-
-if os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'dotbot')):
- if PROJECT_ROOT_DIRECTORY not in sys.path:
- sys.path.insert(0, PROJECT_ROOT_DIRECTORY)
- os.putenv('PYTHONPATH', PROJECT_ROOT_DIRECTORY)
+sys.path.append(PROJECT_ROOT_DIRECTORY)
import dotbot
-def main():
- dotbot.cli.main()
-
-if __name__ == '__main__':
- main()
+dotbot.cli.main()