blob: 7ae7672542099d684b2c25385a3800f002474229 [file] [log] [blame]
agsantos1e7736c2020-10-28 14:39:13 -04001#!/usr/bin/env python3
2#
Sébastien Blincb783e32021-02-12 11:34:10 -05003# Copyright (C) 2020-2021 Savoir-faire Linux Inc.
agsantos1e7736c2020-10-28 14:39:13 -04004#
5# Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20# Creates packaging targets for a distribution and architecture.
21# This helps reduce the length of the top Makefile.
22#
23
24from utils import *
25
26
27def runoption(action):
28 if(initializeClasses(action)):
29 if (action == ACTIONS["CREATE"]):
30 runFullCreation()
31 elif (action == ACTIONS["CREATE_FUNCTIONALITY"]):
32 modifyFunctionality(action)
33 elif (action == ACTIONS["CREATE_MAIN"]):
34 getSkeletonSourceFiles().createMain(addAllowed='n')
35 elif (action == ACTIONS["CREATE_PREFERENCES"] or action == ACTIONS["DELETE_PREFERENCES"]):
36 modifyPreferences(action)
37 elif (action == ACTIONS["CREATE/MODIFY_MANIFEST"] or action == ACTIONS["DELETE_MANIFEST"]):
38 getSkeletonSourceFiles().modifyManifest(action)
39 elif (action == ACTIONS["CREATE_PACKAGE_JSON"]):
40 getSkeletonSourceFiles().createPackageJson()
41 elif (action == ACTIONS["DELETE"]):
42 delete()
43 elif (action == ACTIONS["PREASSEMBLE"]):
44 from jplManipulation import preAssemble
45 preAssemble(getSkeletonSourceFiles().pluginName)
46 elif (action == ACTIONS["BUILD"]):
47 from jplManipulation import build
48 build(getSkeletonSourceFiles().pluginName)
49 elif (action == ACTIONS["ASSEMBLE"]):
50 from jplManipulation import assemble
51 assemble(getSkeletonSourceFiles().pluginName)
52 elif (action == ACTIONS["CREATE_BUILD_FILES"]):
53 getSkeletonSourceFiles().createBuildFiles()
54
55
56def delete():
57 getSkeletonSourceFiles().delete()
58
59
60def modifyPreferences(action):
61 if (action == ACTIONS["DELETE_PREFERENCES"]):
62 getSkeletonSourceFiles().deletePreference()
63 elif (action == ACTIONS["CREATE_PREFERENCES"]):
64 getSkeletonSourceFiles().createPreferences(getSkeletonSourceFiles().names)
65
66
67def runFullCreation():
68 getSkeletonSourceFiles().createManifest()
69 getSkeletonSourceFiles().createMain()
70 getSkeletonSourceFiles().createPackageJson()
71 getSkeletonSourceFiles().createBuildFiles()
72
73
74def modifyFunctionality(action):
75 if (action == ACTIONS["CREATE_FUNCTIONALITY"]):
76 getSkeletonSourceFiles().createFunctionality()