17 if env.get('temp_folder', None): |
17 if env.get('temp_folder', None): |
18 print(green("Removing %s" % env['temp_folder'])) |
18 print(green("Removing %s" % env['temp_folder'])) |
19 shutil.rmtree(env['temp_folder']) |
19 shutil.rmtree(env['temp_folder']) |
20 |
20 |
21 def get_version_path(): |
21 def get_version_path(): |
22 return os.path.join(env['temp_folder'], env['version'], env.source_rel_path) |
22 return os.path.join(env['temp_folder'], env['version']) |
23 |
23 |
24 def export(): |
24 def export(): |
25 local('hg archive -r %s %s' % (env['version'], get_version_path()) ) |
25 local('hg archive -r %s %s' % (env['version'], get_version_path()) ) |
26 |
26 |
27 def pack(): |
27 def pack(): |
28 # create a new source distribution as tarball |
28 # create a new source distribution as tarball |
29 with lcd(get_version_path()): |
29 with lcd(os.path.join(get_version_path(),env.source_rel_path)): |
30 local('python setup.py sdist --formats=gztar', capture=False) |
30 local('python setup.py sdist --formats=gztar', capture=False) |
31 |
31 |
32 def create_virtualenv(): |
32 def create_virtualenv(): |
33 with lcd(get_version_path()): |
33 with lcd(os.path.join(get_version_path(),env.source_rel_path)): |
34 tmpd = run('mktemp -d').strip() |
34 tmpd = run('mktemp -d').strip() |
35 put('virtualenv/*.txt', tmpd) |
35 put('virtualenv/*.txt', tmpd) |
36 run('virtualenv -p %s %s' % (env.srv_python_location,env.srv_venv_path)) |
36 run('virtualenv -p %s %s' % (env.srv_python_location,env.srv_venv_path)) |
37 with prefix('source %s/bin/activate' % env.srv_venv_path): |
37 with prefix('source %s/bin/activate' % env.srv_venv_path): |
38 run('pip install -r %s/requirements.txt' % tmpd) |
38 run('pip install -r %s/requirements.txt' % tmpd) |
46 run('rm -fr %s' % tmpd) |
46 run('rm -fr %s' % tmpd) |
47 |
47 |
48 |
48 |
49 def deploy(): |
49 def deploy(): |
50 # figure out the release name and version |
50 # figure out the release name and version |
51 with lcd(get_version_path()): |
51 with lcd(os.path.join(get_version_path(),env.source_rel_path)): |
52 dist = local('python setup.py --fullname', capture=True).strip() |
52 dist = local('python setup.py --fullname', capture=True).strip() |
53 print(green("dist is %s" % dist)) |
53 print(green("dist is %s" % dist)) |
54 |
54 |
55 # upload the source tarball to the temporary folder on the server |
55 # upload the source tarball to the temporary folder on the server |
56 put('dist/%s.tar.gz' % dist, '/tmp/%s.tar.gz' % dist) |
56 put('dist/%s.tar.gz' % dist, '/tmp/%s.tar.gz' % dist) |