2013-04-27 20:55:42 +04:00
|
|
|
#!/usr/bin/env python
|
2013-02-19 01:06:57 +04:00
|
|
|
|
2017-04-21 02:59:00 +03:00
|
|
|
import contextlib
|
2013-04-27 20:55:42 +04:00
|
|
|
import os
|
2017-10-02 08:30:30 +03:00
|
|
|
import shutil
|
2013-04-27 20:55:42 +04:00
|
|
|
import subprocess
|
2013-05-09 17:09:28 +04:00
|
|
|
import sys
|
2013-02-19 01:06:57 +04:00
|
|
|
|
|
|
|
|
2013-04-27 20:55:42 +04:00
|
|
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
2013-02-19 01:06:57 +04:00
|
|
|
|
2013-04-27 20:55:42 +04:00
|
|
|
|
|
|
|
def main():
|
2015-04-02 14:20:49 +03:00
|
|
|
os.chdir(SOURCE_ROOT)
|
|
|
|
result = (subprocess.call(['git', 'submodule', 'sync']) or
|
|
|
|
subprocess.call(['git', 'submodule', 'update',
|
|
|
|
'--init', '--recursive']))
|
|
|
|
if result:
|
|
|
|
return result
|
2014-01-17 22:42:57 +04:00
|
|
|
|
2017-04-21 02:59:00 +03:00
|
|
|
# Setup boto.
|
|
|
|
with scoped_cwd(os.path.join('vendor', 'boto')):
|
|
|
|
subprocess.call([sys.executable, 'setup.py', 'build'])
|
2017-10-02 08:30:30 +03:00
|
|
|
# On windows python assumes all script names end with .py, if we don't
|
|
|
|
# do so some modules like multiprocessing would break.
|
|
|
|
shutil.copy(os.path.join('bin', 's3put'), os.path.join('bin', 's3put.py'))
|
2017-04-21 02:59:00 +03:00
|
|
|
|
2013-04-27 20:55:42 +04:00
|
|
|
|
2017-04-21 02:59:00 +03:00
|
|
|
@contextlib.contextmanager
|
|
|
|
def scoped_cwd(path):
|
|
|
|
cwd = os.getcwd()
|
|
|
|
os.chdir(path)
|
|
|
|
try:
|
|
|
|
yield
|
|
|
|
finally:
|
|
|
|
os.chdir(cwd)
|
|
|
|
|
|
|
|
|
2013-04-27 20:55:42 +04:00
|
|
|
if __name__ == '__main__':
|
2015-04-02 14:20:49 +03:00
|
|
|
sys.exit(main())
|