Skip to content

Commit

Permalink
add pending deprecation notice for python 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
eli-schwartz authored and jpakkane committed Jan 9, 2022
1 parent 43c6860 commit 09f03a8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/markdown/snippets/about_minimum_python_version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Python 3.6 support will be dropped in the next release

The final [Python 3.6 release was 3.6.15 in September](https://www.python.org/dev/peps/pep-0494/#lifespan).
This release series is now End-of-Life (EOL). The only LTS distribution that
still ships Python 3.5 as the default Python is Ubuntu 18.04, which has Python

This comment has been minimized.

Copy link
@lazka

lazka Jan 10, 2022

Contributor

s/3.5/3.6/

I'm just curious, what does "18.04, which has Python 3.8 available as well" mean? How would you get a 3.8 there?

(Not that I care about old Python version, I was just confused a bit)

This comment has been minimized.

Copy link
@eli-schwartz

eli-schwartz Jan 10, 2022

Author Member

Aghh, another copypasta typo.

Ubuntu has both a python3.6 and a python3.8 package. The python3 package installs 3.6, and that is the version that most of the repository ecosystem is built against. If you install 3.8 you just get the interpreter on its own, nothing else (technically, all pure python modules are still in the pythonpath, they are just utterly broken due to age and not supporting source level updates for 3.8 compat -- it's a really, really, terribly, atrociously badly thought out, or at least implemented, "improvement" to share modules across python versions).

This comment has been minimized.

Copy link
@lazka

lazka Jan 10, 2022

Contributor

Oh, I never knew about the python3.8 package! Thanks for the details.

3.8 available as well.

Python 3.7 has various features that we find useful such as future annotations,
the importlib.resources module, and dataclasses.

As a result, we will begin requiring Python 3.7 or newer in Meson 0.62, which
is the next release. Starting with Meson 0.61, we now print a `NOTICE:` when
a `meson` command is run on Python 3.6 to inform users about this.
11 changes: 11 additions & 0 deletions mesonbuild/mesonmain.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def run_help_command(self, options):
return 0

def run(self, args):
pending_python_deprecation_notice = False
# If first arg is not a known command, assume user wants to run the setup
# command.
known_commands = list(self.commands.keys()) + ['-h', '--help']
Expand All @@ -130,10 +131,17 @@ def run(self, args):
args = args[1:]
else:
parser = self.parser
command = None

args = mesonlib.expand_arguments(args)
options = parser.parse_args(args)

if command is None:
command = options.command

if command in ('setup', 'compile', 'test', 'install') and sys.version_info < (3, 7):
pending_python_deprecation_notice = True

try:
return options.run_func(options)
except MesonException as e:
Expand All @@ -156,6 +164,9 @@ def run(self, args):
mlog.exception(e)
return 2
finally:
if pending_python_deprecation_notice:
mlog.notice('You are using Python 3.6 which is EOL. Starting with v0.62.0, '
'Meson will require Python 3.7 or newer', fatal=False)
mlog.shutdown()

def run_script_command(script_name, script_args):
Expand Down

0 comments on commit 09f03a8

Please sign in to comment.