Skip to content

Commit b278065

Browse files
author
Shun Lin
committed
Merge pull request #302 from hugohuang1111/add_sdkbox_to_console
[A] add sdkbox console
2 parents 63d4c4a + 0f99244 commit b278065

File tree

5 files changed

+25
-32
lines changed

5 files changed

+25
-32
lines changed

config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"version":"v3-console-11",
3-
"zip_file_size":"38391295",
2+
"version":"v3-console-12",
3+
"zip_file_size":"38343506",
44
"repo_name":"console-binary",
55
"repo_parent":"https://github.com/natural-law/"
66
}

plugins/plugin_package/plugin_package.py

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111

1212
__docformat__ = 'restructuredtext'
1313

14+
import os
15+
import sys
1416
import cocos
17+
import subprocess
1518
from MultiLanguage import MultiLanguage
1619

1720
class CCPluginPackage(cocos.CCPlugin):
@@ -24,40 +27,23 @@ def brief_description():
2427
return MultiLanguage.get_string('PACKAGE_BRIEF')
2528

2629
def parse_args(self, argv):
27-
if len(argv) < 1:
28-
self.print_help()
29-
return None
30-
3130
return {"command": argv[0]}
3231

3332
def run(self, argv, dependencies):
34-
args = self.parse_args(argv)
35-
if args is None:
36-
return
37-
38-
command = args["command"]
39-
40-
if command == "search":
41-
from package_search import FrameworkAdd
42-
CommandClass = FrameworkAdd
43-
elif command == "info":
44-
from package_info import PackageInfo
45-
CommandClass = PackageInfo
46-
elif command == "install":
47-
from package_install import PackageInstall
48-
CommandClass = PackageInstall
49-
elif command == "list":
50-
from package_list import PackageList
51-
CommandClass = PackageList
52-
elif command == "-h":
53-
self.print_help()
54-
return
55-
else:
56-
message = MultiLanguage.get_string('PACKAGE_ERROR_INVALID_CMD_FMT', command)
57-
raise cocos.CCPluginError(message, cocos.CCPluginError.ERROR_CMD_NOT_FOUND)
33+
cmd = self._get_sdkbox_path() + ' --runincocos ' + ' '.join(argv)
34+
self._run_cmd(cmd)
5835

59-
commandObject = CommandClass()
60-
commandObject.run(argv[1:])
36+
def _run_cmd(self, command, cwd=None):
37+
# cocos.CMDRunner.run_cmd(command, False, cwd=cwd)
38+
subprocess.call(command, shell=True, cwd=cwd)
39+
40+
def _get_sdkbox_path(self):
41+
path = ''
42+
if getattr(sys, 'frozen', None):
43+
path = os.path.realpath(os.path.dirname(sys.executable))
44+
else:
45+
path = os.path.realpath(os.path.dirname(__file__))
46+
return os.path.join(path, 'sdkbox')
6147

6248
def print_help(self):
6349
print(MultiLanguage.get_string('PACKAGE_HELP'))

plugins/plugin_package/sdkbox

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
#!/bin/bash
3+
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
4+
python ${DIR}/sdkbox.pyc "$@"

plugins/plugin_package/sdkbox.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SET script_path=%~dp0
2+
3+
python %script_path%sdkbox.pyc %*

plugins/plugin_package/sdkbox.pyc

191 KB
Binary file not shown.

0 commit comments

Comments
 (0)