aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2018-01-10 20:45:07 +0800
committerclarkzjw <[email protected]>2018-01-10 20:45:07 +0800
commitc008c037facaf632dc9923bb2ecd4c9542c14c9d (patch)
tree05a612cc3a67f49e3d14138b2f0e062f153295e2 /bootstrap.py
parentf26f6cd71cb436216ce6993ae640e89bbb26226a (diff)
downloadblog.jinwei.me-c008c037facaf632dc9923bb2ecd4c9542c14c9d.tar.gz
+ add Dockerfile
Diffstat (limited to 'bootstrap.py')
-rwxr-xr-xbootstrap.py24
1 files changed, 8 insertions, 16 deletions
diff --git a/bootstrap.py b/bootstrap.py
index 80d9048..0c07b9d 100755
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -1,4 +1,4 @@
1#!/usr/bin/env python2 1#!/usr/bin/env python3
2from __future__ import absolute_import, print_function, unicode_literals 2from __future__ import absolute_import, print_function, unicode_literals
3 3
4import os 4import os
@@ -16,9 +16,9 @@ def fail(message):
16 16
17def has_module(module_name): 17def has_module(module_name):
18 try: 18 try:
19 import imp 19 import implib
20 imp.find_module(module_name) 20 implib.find_module(module_name)
21 del imp 21 del implib
22 return True 22 return True
23 except ImportError: 23 except ImportError:
24 return False 24 return False
@@ -69,12 +69,11 @@ pip_bin = os.path.join(env_dir, 'bin', 'pip')
69python_bin = os.path.join(env_dir, 'bin', 'python') 69python_bin = os.path.join(env_dir, 'bin', 'python')
70virtualenv_bin = which('virtualenv', throw=False) 70virtualenv_bin = which('virtualenv', throw=False)
71virtualenv_exists = os.path.exists(env_dir) and os.path.isfile(python_bin) 71virtualenv_exists = os.path.exists(env_dir) and os.path.isfile(python_bin)
72sphinx_requirements_filepath = os.path.join( 72sphinx_requirements_filepath = os.path.join(project_dir, 'requirements.txt')
73 project_dir, 'requirements.txt')
74 73
75 74
76try: 75try:
77 import virtualenv # NOQA 76 import virtualenv
78except ImportError: 77except ImportError:
79 message = ( 78 message = (
80 'Virtualenv is required for this bootstrap to run.\n' 79 'Virtualenv is required for this bootstrap to run.\n'
@@ -85,7 +84,7 @@ except ImportError:
85 84
86 85
87try: 86try:
88 import pip # NOQA 87 import pip
89except ImportError: 88except ImportError:
90 message = ( 89 message = (
91 'pip is required for this bootstrap to run.\n' 90 'pip is required for this bootstrap to run.\n'
@@ -96,14 +95,6 @@ except ImportError:
96 95
97 96
98def main(): 97def main():
99 if not which('entr', throw=False):
100 message = (
101 '\nentr(1) is used in this app as a cross platform file watcher.'
102 'You can install it via your package manager on most POSIX '
103 'systems. See the site at http://entrproject.org/\n'
104 )
105 print(message)
106
107 if not virtualenv_exists: 98 if not virtualenv_exists:
108 virtualenv_bin = which('virtualenv', throw=False) 99 virtualenv_bin = which('virtualenv', throw=False)
109 100
@@ -119,5 +110,6 @@ def main():
119 if os.path.exists(os.path.join(env_dir, 'build')): 110 if os.path.exists(os.path.join(env_dir, 'build')):
120 os.removedirs(os.path.join(env_dir, 'build')) 111 os.removedirs(os.path.join(env_dir, 'build'))
121 112
113
122if __name__ == '__main__': 114if __name__ == '__main__':
123 main() 115 main()
Powered by cgit v1.2.3 (git 2.41.0)