5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__
= "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
28 This tests the feature of guessing the package name from the given metadata
29 projectname and version.
31 Also overriding this default package name is tested
33 Furthermore that targz is the default packager is tested.
40 python
= TestSCons
.python
41 test
= TestSCons
.TestSCons()
42 tar
= test
.detect('TAR', 'tar')
45 test
.skip_test('tar not found; skipping test\n')
48 # TEST: default package name creation.
52 test
.write( [ 'src', 'main.c' ], r
"""
53 int main( int argc, char* argv[] )
59 test
.write('SConstruct', """
60 env=Environment(tools=['default', 'packaging'])
61 env.Program( 'src/main.c' )
62 env.Package( NAME = 'libfoo',
65 source = [ 'src/main.c', 'SConstruct' ] )
68 test
.run(options
="--debug=stacktrace", stderr
= None)
70 test
.must_exist( 'libfoo-1.2.3.zip' )
73 # TEST: overriding default package name.
76 test
.write('SConstruct', """
77 env=Environment(tools=['default', 'packaging'])
78 env.Program( 'src/main.c' )
79 env.Package( NAME = 'libfoo',
81 PACKAGETYPE = 'src_targz',
82 target = 'src.tar.gz',
83 source = [ 'src/main.c', 'SConstruct' ] )
88 test
.must_exist('src.tar.gz')
91 # TEST: default package name creation with overridden packager.
93 # Windows 10 since at least 1803 supplies bsdtar, so tool
94 # detection will find it - but doesn't supply bzip2, so a
95 # test using it will fail. As a hack, just skip.
97 if sys
.platform
!= 'win32':
98 test
.write('SConstruct', """
99 env=Environment(tools=['default', 'packaging'])
100 env.Program( 'src/main.c' )
101 env.Package( NAME = 'libfoo',
103 PACKAGETYPE = 'src_tarbz2',
104 source = [ 'src/main.c', 'SConstruct' ] )
107 test
.run(stderr
=None)
109 test
.must_exist('libfoo-1.2.3.tar.bz2')
112 # TEST: default package name creation with another packager.
114 # Windows 10 since at least 1803 supplies bsdtar, so tool
115 # detection will find it - but it doesn't support xz
116 # compression so test using it will fail. As a hack, just skip.
118 if sys
.platform
!= 'win32':
119 test
.write('SConstruct', """
120 env=Environment(tools=['default', 'packaging'])
121 env.Program( 'src/main.c' )
122 env.Package( NAME = 'libfoo',
124 PACKAGETYPE = 'src_tarxz',
125 source = [ 'src/main.c', 'SConstruct' ] )
128 test
.run(stderr
=None)
130 test
.must_exist('libfoo-1.2.3.tar.xz')
136 # indent-tabs-mode:nil
138 # vim: set expandtab tabstop=4 shiftwidth=4: