source: sasview/build_tools/jenkins_bumps_docs.py @ eddf6af5

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since eddf6af5 was 6b13570, checked in by trnielsen <torben.nielsen@…>, 9 years ago

Added build script to include bumps documentation files to be used in the SasView? Sphinx documentation

  • Property mode set to 100644
File size: 2.1 KB
Line 
1"""
2Scrip to clone tagged version of bumps to SasView build system
3
4bumps must be at the same level as the Jenkins %WORKSPACE (i.e. Jenkins_job_name)
5
6../Jenkins_job_name/ == ../%WORKSPACE/
7
8../Jenkins_job_name/                  - Working dir for Jenkins jobs
9
10../Jenkins_job_name/build_tools/      - working directory for build files
11
12../bumps/                             - directory for bumps files.
13                                      - see ../Jenkins_job_name/docs/sphinx-docs/build-sphinx.py   
14
15"""
16
17
18import subprocess
19import os
20import shutil
21import errno, stat
22
23
24BUMPS_BRANCH = "v0.7.5.5"
25BUMPS_REPO = 'https://github.com/bumps/bumps'
26CURRENT_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
27BUMPS_TARGET = os.path.join(CURRENT_SCRIPT_DIR,  "..", "..", "bumps")
28
29
30if os.path.isdir(BUMPS_TARGET):
31    os.chdir(BUMPS_TARGET)
32    out_tag=subprocess.check_output(["git","tag"])
33    os.chdir(CURRENT_SCRIPT_DIR)
34    if (out_tag.rstrip() in BUMPS_BRANCH):
35        print "bumps version " + BUMPS_BRANCH + " is allready on disk - exit git clone bumps"
36        quit()
37
38
39
40
41
42def _remove_dir(dir_path):
43    """Removes the given directory."""
44    if os.path.isdir(dir_path):
45        print "Removing \"%s\"... " % dir_path
46        shutil.rmtree(dir_path,ignore_errors=False,onerror=errorRemoveReadonly)
47           
48
49
50def errorRemoveReadonly(func, path, exc):
51    excvalue = exc[1]
52    if func in (os.rmdir, os.remove) and excvalue.errno == errno.EACCES:
53        # change the file to be readable,writable,executable: 0777
54        os.chmod(path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) 
55        # retry
56        func(path)
57    else:
58        print "Error"
59
60
61
62def clean():
63    """
64    Clean the Bumps target directory.
65    """
66    print "=== Remove old Bumps Target ==="
67    _remove_dir(BUMPS_TARGET)
68
69
70clean()
71
72
73
74
75
76p = subprocess.Popen(["git","clone", "--branch="+BUMPS_BRANCH,"--depth=1", BUMPS_REPO, BUMPS_TARGET],
77                     stdin=subprocess.PIPE, 
78                     stdout=subprocess.PIPE) 
79
80output = p.communicate('S\nL\n')[0]
81print output
Note: See TracBrowser for help on using the repository browser.