Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit973e29e

Browse files
committed
Added tools directory with an outline of a regression testing script.
1 parent4653e16 commit973e29e

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed

‎libs/network/tools/regression.py

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Copyright (c) Glyn Matthews 2010.
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# (See accompanying file LICENSE_1_0.txt or copy at
4+
# http://www.boost.org/LICENSE_1_0.txt)
5+
#
6+
# This script downloads either a tarball or zipfile of the latest version of the
7+
# main repo.
8+
#
9+
10+
11+
importos
12+
importurllib2
13+
fromurlparseimporturlparse
14+
importoptparse
15+
importtarfile
16+
importstring
17+
18+
19+
repo_root='http://github.com/mikhailberis/cpp-netlib/'
20+
stage='/tmp'
21+
branch='0.6-devel'
22+
23+
24+
25+
defcheck_boost_installation():
26+
""" Gets information about the user's boost environment. """
27+
28+
env=os.getenv('BOOST_ROOT')
29+
assert(envisnotNone)
30+
31+
# get boost version from version.hpp
32+
version=None
33+
version_hpp=os.path.join(env,'boost','version.hpp')
34+
f=open(version_hpp)
35+
forlineinf:
36+
ifline.startswith('#define BOOST_LIB_VERSION'):
37+
begin=string.find(line,'"')
38+
end=string.rfind(line,'"')
39+
version=line[begin+1:end]
40+
41+
assert(versionisnotNone)
42+
43+
return {'root':env,
44+
'version':version }
45+
46+
47+
defdownload_tarball():
48+
""" Downloads the latest tarball from the mikhailberis fork. """
49+
50+
printrepo_root+'tarball/'+branch
51+
r=urllib2.urlopen(repo_root+'tarball/'+branch)
52+
filename=urlparse(r.geturl()).path.split('/')[-1]
53+
path=os.path.join(stage,filename)
54+
f=open(path,'w+')
55+
f.write(r.read())
56+
returnfilename
57+
58+
defunpack_tarball(stage,filename):
59+
""" Unpacks the tarball into a stage directory. """
60+
61+
os.chdir(stage)
62+
f=tarfile.open(os.path.join(stage,filename))
63+
f.extractall()
64+
(root,ext)=os.path.splitext(filename)
65+
print(root)
66+
os.chdir(root)
67+
68+
69+
defdownload_zipball():
70+
""" Downloads the latest zipfile from the mikhailberis fork. """
71+
72+
r=urllib2.urlopen(repo_root+'/zipball/'+branch)
73+
filename=urlparse(r.geturl()).path.split('/')[-1]
74+
path=os.path.join(stage,filename)
75+
f=open(path,'w+')
76+
f.write(r.read())
77+
returnfilename
78+
79+
defunpack_zipball(stage,filename):
80+
""" Unpacks the zip file into a stage directory. """
81+
82+
f=zipfile.ZipFile(os.path.join(stage,filename))
83+
f.extractall()
84+
85+
86+
defbuild():
87+
""" Invokes bjam. Runs all unit tests. """
88+
89+
# Somehow we have to report any failures
90+
91+
92+
if__name__=='__main__':
93+
94+
params=check_boost_installation()
95+
print(params)
96+
97+
# try:
98+
# opt = optparse.OptionParser(
99+
# usage="%prog [options]")
100+
#
101+
# opt.add_option('--zip',
102+
# help='uses the zip')
103+
# opt.add_option('--tar',
104+
# help='uses the tar.gz')
105+
# opt.add_option('--stage',
106+
# help='the stage directory')
107+
# opt.add_option('--branch',
108+
# help='the branch to check.')
109+
#
110+
# opt.parse_args()
111+
#
112+
#
113+
# filename = download_tarball()
114+
# print(filename)
115+
# unpack_tarball(stage, filename)
116+
#
117+
# except urllib2.URLError, e:
118+
# print('%s' % e)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp