Skip to content

Commit

Permalink
Merge pull request #127 from SummerLife/master
Browse files Browse the repository at this point in the history
[update] env upgrade
  • Loading branch information
armink committed May 29, 2020
2 parents 90777e2 + dab56ae commit 84900c3
Show file tree
Hide file tree
Showing 5 changed files with 567 additions and 537 deletions.
30 changes: 30 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# .gitattributes for Env Project.

# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
# ============
* text=auto

# Source files
# ============
*.pxd text eol=crlf diff=python
*.py text eol=crlf diff=python
*.py3 text eol=crlf diff=python
*.pyw text eol=crlf diff=python
*.pyx text eol=crlf diff=python
*.pyz text eol=crlf diff=python
*.pyi text eol=crlf diff=python

# Binary files
# ============
*.db binary
*.p binary
*.pkl binary
*.pickle binary
*.pyc binary
*.pyd binary
*.pyo binary

# MarkDown
*.md text eol=crlf

8 changes: 4 additions & 4 deletions cmds/cmd_package/cmd_package_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import os
from vars import Import
from .cmd_package_utils import git_pull_repo, get_url_from_mirror_server, find_macro_in_config
from .cmd_package_update import need_using_mirror_download


def upgrade_packages_index():
Expand All @@ -35,9 +36,8 @@ def upgrade_packages_index():
pkgs_root = Import('pkgs_root')
env_kconfig_path = os.path.join(env_root, r'tools\scripts\cmds')
env_config_file = os.path.join(env_kconfig_path, '.config')
if (not os.path.isfile(env_config_file)) or \
(os.path.isfile(env_config_file) and find_macro_in_config(env_config_file, 'SYS_PKGS_DOWNLOAD_ACCELERATE')):

if need_using_mirror_download(env_config_file):
get_package_url, get_ver_sha = get_url_from_mirror_server('packages', 'latest')

if get_package_url is not None:
Expand Down Expand Up @@ -80,8 +80,8 @@ def upgrade_env_script():
env_root = Import('env_root')
env_kconfig_path = os.path.join(env_root, r'tools\scripts\cmds')
env_config_file = os.path.join(env_kconfig_path, '.config')
if (not os.path.isfile(env_config_file)) or \
(os.path.isfile(env_config_file) and find_macro_in_config(env_config_file, 'SYS_PKGS_DOWNLOAD_ACCELERATE')):

if need_using_mirror_download(env_config_file):
get_package_url, get_ver_sha = get_url_from_mirror_server('env', 'latest')

if get_package_url is not None:
Expand Down
108 changes: 54 additions & 54 deletions cmds/cmd_system.py
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
# -*- coding:utf-8 -*-
#
# File : cmd_system.py
# This file is part of RT-Thread RTOS
# COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Change Logs:
# Date Author Notes
# 2018-5-28 SummerGift Add copyright information
#

import os
from vars import Import

'''RT-Thread environment package system'''


def cmd(args):
packages_root = os.path.join(Import('env_root'), 'packages')

if args.system_update:
dir_list = os.listdir(packages_root)

with open(os.path.join(packages_root, 'Kconfig'), 'w') as kconfig:
for item in dir_list:
if os.path.isfile(os.path.join(packages_root, item, 'Kconfig')):
kconfig.write('source "$PKGS_DIR/' + item + '/Kconfig"')
kconfig.write('\n')


def add_parser(sub):
parser = sub.add_parser('system', help=__doc__, description=__doc__)

parser.add_argument('--update',
help='update system menuconfig\'s online package options ',
action='store_true',
default=False,
dest='system_update')

parser.set_defaults(func=cmd)
# -*- coding:utf-8 -*-
#
# File : cmd_system.py
# This file is part of RT-Thread RTOS
# COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Change Logs:
# Date Author Notes
# 2018-5-28 SummerGift Add copyright information
#

import os
from vars import Import

'''RT-Thread environment package system'''


def cmd(args):
packages_root = os.path.join(Import('env_root'), 'packages')

if args.system_update:
dir_list = os.listdir(packages_root)

with open(os.path.join(packages_root, 'Kconfig'), 'w') as kconfig:
for item in dir_list:
if os.path.isfile(os.path.join(packages_root, item, 'Kconfig')):
kconfig.write('source "$PKGS_DIR/' + item + '/Kconfig"')
kconfig.write('\n')


def add_parser(sub):
parser = sub.add_parser('system', help=__doc__, description=__doc__)

parser.add_argument('--update',
help='update system menuconfig\'s online package options ',
action='store_true',
default=False,
dest='system_update')

parser.set_defaults(func=cmd)
Loading

0 comments on commit 84900c3

Please sign in to comment.