diff options
author | clarkzjw <[email protected]> | 2018-01-10 20:45:07 +0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2018-01-10 20:45:07 +0800 |
commit | c008c037facaf632dc9923bb2ecd4c9542c14c9d (patch) | |
tree | 05a612cc3a67f49e3d14138b2f0e062f153295e2 /bootstrap.py | |
parent | f26f6cd71cb436216ce6993ae640e89bbb26226a (diff) | |
download | blog.jinwei.me-c008c037facaf632dc9923bb2ecd4c9542c14c9d.tar.gz |
+ add Dockerfile
Diffstat (limited to 'bootstrap.py')
-rwxr-xr-x | bootstrap.py | 24 |
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 |
2 | from __future__ import absolute_import, print_function, unicode_literals | 2 | from __future__ import absolute_import, print_function, unicode_literals |
3 | 3 | ||
4 | import os | 4 | import os |
@@ -16,9 +16,9 @@ def fail(message): | |||
16 | 16 | ||
17 | def has_module(module_name): | 17 | def 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') | |||
69 | python_bin = os.path.join(env_dir, 'bin', 'python') | 69 | python_bin = os.path.join(env_dir, 'bin', 'python') |
70 | virtualenv_bin = which('virtualenv', throw=False) | 70 | virtualenv_bin = which('virtualenv', throw=False) |
71 | virtualenv_exists = os.path.exists(env_dir) and os.path.isfile(python_bin) | 71 | virtualenv_exists = os.path.exists(env_dir) and os.path.isfile(python_bin) |
72 | sphinx_requirements_filepath = os.path.join( | 72 | sphinx_requirements_filepath = os.path.join(project_dir, 'requirements.txt') |
73 | project_dir, 'requirements.txt') | ||
74 | 73 | ||
75 | 74 | ||
76 | try: | 75 | try: |
77 | import virtualenv # NOQA | 76 | import virtualenv |
78 | except ImportError: | 77 | except 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 | ||
87 | try: | 86 | try: |
88 | import pip # NOQA | 87 | import pip |
89 | except ImportError: | 88 | except 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 | ||
98 | def main(): | 97 | def 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 | |||
122 | if __name__ == '__main__': | 114 | if __name__ == '__main__': |
123 | main() | 115 | main() |