-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpisi_action.tcl
59 lines (47 loc) · 2.11 KB
/
pisi_action.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 2.
# See the file http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
#Creating pspec.xml and action.py
namespace eval ::pisi_action {
#create actions.py
proc Create {} {
global xPatch xsetup xbuild xinstall xkde xconfopt xWorkDir
PutMessage [format "[uplevel #0 {set MSG_saving}]" "[pwd]/actions.py"]
set xsetup [::pisi_action::Normalization $xsetup]
set xbuild [::pisi_action::Normalization $xbuild]
set xinstall [::pisi_action::Normalization $xinstall]
set fh [open "actions.py" "w"]
puts $fh "#!/usr/bin/python"
puts $fh "# -*- coding: utf-8 -*-"
puts $fh "#"
puts $fh "# Licensed under the GNU General Public License, version 2."
puts $fh "# See the file http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt\n"
if {[regexp " kde\." "$xsetup$xbuild$xinstall"]} {puts $fh "from pisi.actionsapi import kde"}
if {[regexp " autotools\." "$xsetup$xbuild$xinstall"]} {puts $fh "from pisi.actionsapi import autotools"}
if {[regexp " pisitools\." "$xsetup$xbuild$xinstall"]} {puts $fh "from pisi.actionsapi import pisitools"}
if {[regexp " shelltools\." "$xsetup$xbuild$xinstall"]} {puts $fh "from pisi.actionsapi import shelltools"}
if {[regexp " get\." "$xsetup$xbuild$xinstall"]} {puts $fh "from pisi.actionsapi import get"}
if { $xWorkDir != "" } {
puts $fh "\nWorkDir = $xWorkDir"
}
puts $fh ""
if {$xsetup != ""} {
puts $fh "def setup():"
puts $fh "$xsetup"
}
if {$xbuild != ""} {
puts $fh "def build():"
puts $fh "$xbuild"
}
puts $fh "def install():"
puts $fh "$xinstall"
close $fh
uplevel #0 {PutMessage "[format $MSG_saving action.py]"}
}
proc Normalization {a} {
regsub -all "autotools.make\\(\"\"\\)" $a "autotools.make\(\)" a
regsub -all "autotools.make\\(\\).?.?.?.? autotools.make\\(\\)" $a "autotools.make\(\)" a
return $a
}
}