Skip to content

Commit 7e72646

Browse files
committed
[更新] 优化配置文件, 添加exe文件.
1 parent 8276792 commit 7e72646

7 files changed

Lines changed: 59 additions & 24 deletions

File tree

buildpkg.exe

9.06 MB
Binary file not shown.

buildpkg.py

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@
7777
7878
"templates":
7979
{
80-
"github-ci" : "template-github-ci.txt",
81-
"kconfig" : "template-kconfig.txt",
82-
"package-json" : "template-package-json.txt",
83-
"readme" : "template-readme-rtt.txt",
80+
"readme_md" : "template-readme-rtt.txt",
8481
"sconscript" : "template-sconscript.txt",
85-
"sconscript-example": "template-sconscript-example.txt"
82+
"sconscript_example": "template-sconscript-example.txt",
83+
"ci_github" : "template-ci-github.txt",
84+
"kconfig" : "template-kconfig.txt",
85+
"package_json" : "template-package-json.txt"
8686
},
8787
"pkg_def_version" : "v1.0.0",
88-
"commit_content" : "[builpkg] Use the buildpkg tool to quickly build ${pkgname}'s packages!"
88+
"commit_content" : "[builpkg] Use the buildpkg tool to quickly build ${pkgname}'s packages!"
8989
}
9090
"""
9191

@@ -129,6 +129,17 @@ def _create_log(log_name, log_path, level = logging.INFO, console = True):
129129

130130
return log
131131

132+
# --------------------------------------------------------------------------------
133+
# Save confg
134+
# --------------------------------------------------------------------------------
135+
def _save_config(filename):
136+
if sys.version_info < (3, 0):
137+
with open(filename, "w") as _file:
138+
_file.write(json.dumps(_config, indent=4))
139+
else:
140+
with open(filename, "w", encoding='utf-8') as _file:
141+
_file.write(json.dumps(_config, indent=4))
142+
132143
# --------------------------------------------------------------------------------
133144
# Load confg
134145
# --------------------------------------------------------------------------------
@@ -157,7 +168,7 @@ def _load_config(filename):
157168

158169
_run_log.info("Fix the config.json file contents.")
159170

160-
# load config
171+
# 3. load config
161172
global _config
162173
global _templates
163174

@@ -166,6 +177,15 @@ def _load_config(filename):
166177
_templates = _config["templates"]
167178
_run_log.debug("Buildpkg load config: \n" + json.dumps(_config, indent=4))
168179

180+
# 4. check that the user name is configured
181+
if _config["username"] == "None":
182+
_run_log.info("Please enter your github username: ")
183+
_config["username"] = input()
184+
if _config["username"] != "" and _config["username"] != "None":
185+
_save_config("config.json")
186+
187+
_run_log.info("Update %s to config.json." % (_config["username"]))
188+
169189
# --------------------------------------------------------------------------------
170190
# Check self(It will load the configuration)
171191
# --------------------------------------------------------------------------------
@@ -320,7 +340,7 @@ def _make_package(pkgname, version = None, license = None):
320340
os.makedirs(_buildpkg_packages_xxx_path)
321341

322342
os.makedirs(_buildpkg_packages_xxx_example_path)
323-
os.makedirs(_buildpkg_packages_xxx_scripts_path)
343+
# os.makedirs(_buildpkg_packages_xxx_scripts_path)
324344

325345
# 1. Generate the /readme.md file
326346
_generate_file(_templates["readme_md"], "readme.md", _replace_list)
@@ -333,6 +353,9 @@ def _make_package(pkgname, version = None, license = None):
333353
_generate_file(_templates["sconscript_example"], _example_sconscript_path, _replace_list)
334354

335355
# 4. Generate the /.travis.yml file
356+
_templates_ci_script_dir_path = os.path.join(_buildpkg_template_path, "ci_script_github")
357+
358+
shutil.copytree(_templates_ci_script_dir_path, _buildpkg_packages_xxx_scripts_path)
336359
_generate_file(_templates["ci_github"], ".travis.yml", _replace_list)
337360

338361
# 5. Generate the /LICENSE file
@@ -421,6 +444,12 @@ def main():
421444

422445
_run_log = _create_log("run_log", _BUILDPKG_RUN_LOG_FILE, logging.DEBUG if _BUILDPKG_RELEASE == False else logging.INFO, True)
423446
_pkg_log = _create_log("pkg_log", _BUILDPKG_PKG_LOG_FILE, logging.DEBUG, False)
447+
448+
_run_log.info("<< Start run buildpkg >>")
449+
_run_log.info("Version : %s" % (_BUILDPKG_VERSION))
450+
_run_log.info("Author : %s" % (_BUILDPKG_AUTHOR))
451+
_run_log.info("License : %s" % (_BUILDPKG_LICENSE))
452+
_run_log.info("Conteributors: %s" % (str(_BUILDPKG_CONTRIBUTORS)))
424453

425454
# 2. analyze path
426455
_analyze_path(_args.pkgname)

config.json

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
{
2-
"username" : "liu2guang",
3-
"list_ignore_inc" : [".git", "example", "doc", "test"],
4-
"list_ignore_src" : ["test.c", "example.c"],
5-
6-
"templates":
7-
{
8-
"readme_md" : "template-readme-rtt.txt",
9-
"sconscript" : "template-sconscript.txt",
10-
"sconscript_example": "template-sconscript-example.txt",
11-
"ci_github" : "template-ci-github.txt",
12-
"kconfig" : "template-kconfig.txt",
13-
"package_json" : "template-package-json.txt"
2+
"username": "liu2gunag",
3+
"list_ignore_inc": [
4+
".git",
5+
"example",
6+
"doc",
7+
"test"
8+
],
9+
"list_ignore_src": [
10+
"test.c",
11+
"example.c"
12+
],
13+
"templates": {
14+
"readme_md": "template-readme-rtt.txt",
15+
"sconscript": "template-sconscript.txt",
16+
"sconscript_example": "template-sconscript-example.txt",
17+
"ci_github": "template-ci-github.txt",
18+
"kconfig": "template-kconfig.txt",
19+
"package_json": "template-package-json.txt"
1420
},
15-
"pkg_def_version" : "v1.0.0",
16-
"commit_content" : "[builpkg] Use the buildpkg tool to quickly build ${pkgname}'s packages!"
17-
}
21+
"pkg_def_version": "v1.0.0",
22+
"commit_content": "[builpkg] Use the buildpkg tool to quickly build ${pkgname}'s packages!"
23+
}

figures/logo.ico

1.64 MB
Binary file not shown.

release.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@echo off
2-
pyinstaller -F .\buildpkg.py
2+
pyinstaller -F --icon=.\figures\logo.ico .\buildpkg.py
33
copy .\dist\buildpkg.exe buildpkg.exe
44
rd /s /Q .\__pycache__
55
rd /s /Q .\build

0 commit comments

Comments
 (0)