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 )
0 commit comments