Skip to content

Commit

Permalink
Tools: Remove MSYS/Mingw support
Browse files Browse the repository at this point in the history
MSYS/Mingw was deprecated since v4.0 and it is removed in v5.0. Please
follow the getting started guide of the documentation to set up a
Windows Command Line or Power Shell based environment.
  • Loading branch information
dobairoland committed Nov 10, 2021
1 parent 6ef6c2a commit a1d0d1f
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 205 deletions.
5 changes: 1 addition & 4 deletions docs/en/contribute/install-pre-commit-hook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Common Problems For Windows Users

``/usr/bin/env: python: Permission denied.``

If you're in Git Bash or MSYS terminal, please check the python executable location by run ``which python``.
If you're in Git Bash, please check the python executable location by run ``which python``.

If the executable is under ``~/AppData/Local/Microsoft/WindowsApps/``, then it's a link to Windows AppStore, not a real one.

Expand All @@ -53,6 +53,3 @@ Your %USERPROFILE% contains non-ASCII characters
- CMD: ``set PRE_COMMIT_HOME=C:\somepath\pre-commit``
- PowerShell: ``$Env:PRE_COMMIT_HOME = "C:\somepath\pre-commit"``
- git bash: ``export PRE_COMMIT_HOME="/c/somepath/pre-commit"``



2 changes: 1 addition & 1 deletion docs/en/contribute/style-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Line Endings

Commits should only contain files with LF (Unix style) endings.

Windows users can configure git to check out CRLF (Windows style) endings locally and commit LF endings by setting the ``core.autocrlf`` setting. `Github has a document about setting this option <github-line-endings>`. However because MSYS2 uses Unix-style line endings, it is often easier to configure your text editor to use LF (Unix style) endings when editing ESP-IDF source files.
Windows users can configure git to check out CRLF (Windows style) endings locally and commit LF endings by setting the ``core.autocrlf`` setting. `Github has a document about setting this option <github-line-endings>`.

If you accidentally have some commits in your branch that add LF endings, you can convert them to Unix by running this command in an MSYS2 or Unix terminal (change directory to the IDF working directory and check the correct branch is currently checked out, beforehand):

Expand Down
2 changes: 1 addition & 1 deletion docs/en/get-started/windows-setup-scratch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Get ESP-IDF

Previous versions of ESP-IDF used the **MSYS2 bash terminal** command line. The current cmake-based build system can run in the regular **Windows Command Prompt** which is used here.

If you use a bash-based terminal or PowerShell, please note that some command syntax will be different to what is shown below.
If you use PowerShell, please note that some command syntax will be different to what is shown below.

Open Command Prompt and run the following commands:

Expand Down
1 change: 0 additions & 1 deletion docs/en/get-started/windows-setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ For advanced users who want to customize the install process:
windows-setup-update


.. _MSYS2: https://www.msys2.org/
.. _CMake: https://cmake.org/download/
.. _Ninja: https://ninja-build.org/
.. _Python: https://www.python.org/downloads/windows/
Expand Down
1 change: 0 additions & 1 deletion docs/zh_CN/get-started/windows-setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ ESP-IDF 工具安装器可在“开始”菜单中,创建一个打开 ESP-IDF
windows-setup-update


.. _MSYS2: https://www.msys2.org/
.. _CMake: https://cmake.org/download/
.. _Ninja: https://ninja-build.org/
.. _Python: https://www.python.org/downloads/windows/
Expand Down
3 changes: 1 addition & 2 deletions export.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@echo off
if defined MSYSTEM (
echo This .bat file is for Windows CMD.EXE shell only. When using MSYS, run:
echo . ./export.sh.
echo This .bat file is for Windows CMD.EXE shell only.
goto :eof
)

Expand Down
3 changes: 1 addition & 2 deletions install.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@echo off
if defined MSYSTEM (
echo This .bat file is for Windows CMD.EXE shell only. When using MSYS, run:
echo ./install.sh.
echo This .bat file is for Windows CMD.EXE shell only.
goto end
)

Expand Down
10 changes: 3 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ pygdbmi<=0.9.0.2
# A compatible Socket.IO should be used. See https://github.com/miguelgrinberg/python-socketio/issues/578
python-socketio<5

kconfiglib==13.7.1

# esptool requirements (see components/esptool_py/esptool/setup.py)
reedsolo>=1.5.3,<=1.5.4
bitstring>=3.1.6
Expand All @@ -38,8 +36,6 @@ ecdsa>=0.16.0
# This is the last version supports both 2.7 and 3.4
construct==2.10.54

# windows-curses are required in Windows command line but cannot be installed in MSYS2. A requirement like
# "windows-curses; sys_platform == 'win32'" would want to install the package on both of them. There is no environment
# marker for detecting MSYS2. So instead, a dummy custom package is used with "windows-curses" dependency for Windows
# command line.
file://${IDF_PATH}/tools/kconfig_new/esp-windows-curses; sys_platform == 'win32'
# kconfig & menuconfig support
kconfiglib==13.7.1
windows-curses; sys_platform == 'win32'
22 changes: 1 addition & 21 deletions tools/check_python_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,31 +63,11 @@ def escape_backslash(path):
elif os.environ.get('IDF_PYTHON_ENV_PATH'):
# We are running inside a private virtual environment under IDF_TOOLS_PATH,
# ask the user to run install.bat again.
if sys.platform == 'win32' and not os.environ.get('MSYSTEM'):
if sys.platform == 'win32':
install_script = 'install.bat'
else:
install_script = 'install.sh'
print('To install the missing packages, please run "%s"' % os.path.join(idf_path, install_script)) # type: ignore
elif sys.platform == 'win32' and os.environ.get('MSYSTEM', None) == 'MINGW32' and '/mingw32/bin/python' in sys.executable:
print("The recommended way to install a packages is via \"pacman\". Please run \"pacman -Ss <package_name>\" for"
' searching the package database and if found then '
"\"pacman -S mingw-w64-i686-python-<package_name>\" for installing it.")
print("NOTE: You may need to run \"pacman -Syu\" if your package database is older and run twice if the "
"previous run updated \"pacman\" itself.")
print('Please read https://github.com/msys2/msys2/wiki/Using-packages for further information about using '
"\"pacman\"")
# Special case for MINGW32 Python, needs some packages
# via MSYS2 not via pip or system breaks...
for requirement in not_satisfied:
if requirement.startswith('cryptography'):
print('WARNING: The cryptography package have dependencies on system packages so please make sure '
"you run \"pacman -Syu\" followed by \"pacman -S mingw-w64-i686-python{}-cryptography\"."
''.format(sys.version_info[0],))
continue
elif requirement.startswith('setuptools'):
print("Please run the following command to install MSYS2's MINGW Python setuptools package:")
print('pacman -S mingw-w64-i686-python-setuptools')
continue
else:
print('Please follow the instructions found in the "Set up the tools" section of '
'ESP-IDF Getting Started Guide')
Expand Down
1 change: 0 additions & 1 deletion tools/ci/check_copyright_ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3625,7 +3625,6 @@ tools/kconfig/qconf.h
tools/kconfig/symbol.c
tools/kconfig/util.c
tools/kconfig_new/confserver.py
tools/kconfig_new/esp-windows-curses/setup.py
tools/kconfig_new/gen_kconfig_doc.py
tools/kconfig_new/prepare_kconfig_files.py
tools/kconfig_new/test/confgen/test_confgen.py
Expand Down
1 change: 0 additions & 1 deletion tools/ci/mypy_ignore_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ tools/idf_py_actions/tools.py
tools/idf_py_actions/uf2_ext.py
tools/kconfig_new/confgen.py
tools/kconfig_new/confserver.py
tools/kconfig_new/esp-windows-curses/setup.py
tools/kconfig_new/gen_kconfig_doc.py
tools/kconfig_new/prepare_kconfig_files.py
tools/kconfig_new/test/confgen/test_confgen.py
Expand Down
22 changes: 3 additions & 19 deletions tools/idf.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,25 +776,9 @@ def _find_usable_locale():

if __name__ == '__main__':
try:
# On MSYS2 we need to run idf.py with "winpty" in order to be able to cancel the subprocesses properly on
# keyboard interrupt (CTRL+C).
# Using an own global variable for indicating that we are running with "winpty" seems to be the most suitable
# option as os.environment['_'] contains "winpty" only when it is run manually from console.
WINPTY_VAR = 'WINPTY'
WINPTY_EXE = 'winpty'
if ('MSYSTEM' in os.environ) and (not os.environ.get('_', '').endswith(WINPTY_EXE)
and WINPTY_VAR not in os.environ):

if 'menuconfig' in sys.argv:
# don't use winpty for menuconfig because it will print weird characters
main()
else:
os.environ[WINPTY_VAR] = '1' # the value is of no interest to us
# idf.py calls itself with "winpty" and WINPTY global variable set
ret = subprocess.call([WINPTY_EXE, sys.executable] + sys.argv, env=os.environ)
if ret:
raise SystemExit(ret)

if 'MSYSTEM' in os.environ:
print_warning('MSys/Mingw is no longer supported. Please follow the getting started guide of the '
'documentation in order to set up a suitiable environment, or continue at your own risk.')
elif os.name == 'posix' and not _valid_unicode_config():
# Trying to find best utf-8 locale available on the system and restart python with it
best_locale = _find_usable_locale()
Expand Down
27 changes: 7 additions & 20 deletions tools/idf_py_actions/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,6 @@
import os
import platform

# Make flavors, across the various kinds of Windows environments & POSIX...
if 'MSYSTEM' in os.environ: # MSYS
MAKE_CMD = 'make'
MAKE_GENERATOR = 'MSYS Makefiles'
elif os.name == 'nt': # other Windows
MAKE_CMD = 'mingw32-make'
MAKE_GENERATOR = 'MinGW Makefiles'
elif platform.system() == 'FreeBSD':
MAKE_CMD = 'gmake'
MAKE_GENERATOR = 'Unix Makefiles'
else:
MAKE_CMD = 'make'
MAKE_GENERATOR = 'Unix Makefiles'

GENERATORS = collections.OrderedDict([
# - command: build command line
# - version: version command line
Expand All @@ -28,14 +14,15 @@
'dry_run': ['ninja', '-n'],
'verbose_flag': '-v'
}),
(MAKE_GENERATOR, {
'command': [MAKE_CMD, '-j', str(multiprocessing.cpu_count() + 2)],
'version': [MAKE_CMD, '--version'],
'dry_run': [MAKE_CMD, '-n'],
'verbose_flag': 'VERBOSE=1',
})
])

if os.name != 'nt':
MAKE_CMD = 'gmake' if platform.system() == 'FreeBSD' else 'make'
GENERATORS['Unix Makefiles'] = {'command': [MAKE_CMD, '-j', str(multiprocessing.cpu_count() + 2)],
'version': [MAKE_CMD, '--version'],
'dry_run': [MAKE_CMD, '-n'],
'verbose_flag': 'VERBOSE=1'}

URL_TO_DOC = 'https://docs.espressif.com/projects/esp-idf'

SUPPORTED_TARGETS = ['esp32', 'esp32s2', 'esp32c3', 'esp32s3']
Expand Down
3 changes: 0 additions & 3 deletions tools/idf_py_actions/serial_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@ def monitor(action, ctx, args, print_filter, monitor_baud, encrypted, timestamps
idf_py = [PYTHON] + _get_commandline_options(ctx) # commands to re-run idf.py
monitor_args += ['-m', ' '.join("'%s'" % a for a in idf_py)]

if 'MSYSTEM' in os.environ:
monitor_args = ['winpty'] + monitor_args

run_tool('idf_monitor', monitor_args, args.project_dir)

def flash(action, ctx, args):
Expand Down
15 changes: 6 additions & 9 deletions tools/idf_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,6 @@ def to_shell_specific_paths(paths_list): # type: (list[str]) -> list[str]
if sys.platform == 'win32':
paths_list = [p.replace('/', os.path.sep) if os.path.sep in p else p for p in paths_list]

if 'MSYSTEM' in os.environ:
paths_msys = run_cmd_check_output(['cygpath', '-u', '-f', '-'],
input_text='\n'.join(paths_list))
paths_list = paths_msys.decode().strip().split('\n')

return paths_list


Expand Down Expand Up @@ -1257,17 +1252,15 @@ def action_export(args): # type: ignore
if idf_tools_dir not in current_path:
paths_to_export.append(idf_tools_dir)

if sys.platform == 'win32' and 'MSYSTEM' not in os.environ:
if sys.platform == 'win32':
old_path = '%PATH%'
path_sep = ';'
else:
old_path = '$PATH'
# can't trust os.pathsep here, since for Windows Python started from MSYS shell,
# os.pathsep will be ';'
path_sep = ':'

if args.format == EXPORT_SHELL:
if sys.platform == 'win32' and 'MSYSTEM' not in os.environ:
if sys.platform == 'win32':
export_format = 'SET "{}={}"'
export_sep = '\n'
else:
Expand Down Expand Up @@ -1819,4 +1812,8 @@ def main(argv): # type: (list[str]) -> None


if __name__ == '__main__':
if 'MSYSTEM' in os.environ:
fatal('MSys/Mingw is not supported. Please follow the getting started guide of the documentation to set up '
'a supported environment')
raise SystemExit(1)
main(sys.argv[1:])
31 changes: 0 additions & 31 deletions tools/kconfig_new/esp-windows-curses/setup.py

This file was deleted.

81 changes: 0 additions & 81 deletions tools/windows/windows_install_prerequisites.sh

This file was deleted.

0 comments on commit a1d0d1f

Please sign in to comment.