2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 from __future__
import print_function
9 from optparse
import OptionParser
11 from sys
import stderr
13 from subprocess
import check_output
15 from subprocess
import Popen
, PIPE
16 def check_output(*cmd
):
17 return Popen(*cmd
, stdout
=PIPE
).communicate()[0]
19 opts
.add_option('--repository', help='maven repository id')
20 opts
.add_option('--url', help='maven repository url')
21 opts
.add_option('-a', help='action (valid actions are: install,deploy)')
22 opts
.add_option('-v', help='libreoffice version')
23 opts
.add_option('-s', action
='append', help='triplet of artifactId:type:path')
25 args
, ctx
= opts
.parse_args()
27 print('version is empty', file=stderr
)
31 '-DgroupId=org.libreoffice',
32 '-Dversion=%s' % args
.v
,
35 self
= path
.dirname(path
.abspath(__file__
))
36 mvn
= ['mvn', '--file', path
.join(self
, 'fake_pom.xml')]
38 if 'install' == args
.a
:
39 cmd
= mvn
+ ['install:install-file'] + common
40 elif 'deploy' == args
.a
:
43 '-DrepositoryId=%s' % args
.repository
,
44 '-Durl=%s' % args
.url
,
47 print("unknown action -a %s" % args
.a
, file=stderr
)
51 artifact
, packaging_type
, src
= spec
.split(':')
54 '-DartifactId=%s' % artifact
,
55 '-Dpackaging=%s' % packaging_type
,
58 except Exception as e
:
59 print('%s command failed: %s' % (args
.a
, e
), file=stderr
)