diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 59baef8e7c..4efcc47fda 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2880,6 +2880,14 @@ for basename in del_files: p3d_init = """"Python bindings for the Panda3D libraries" __version__ = '%s' + +if __debug__: + import sys + if sys.version_info < (3, 0): + sys.stderr.write("WARNING: Python 2.7 will reach EOL after December 31, 2019.\\n") + sys.stderr.write("To suppress this warning, upgrade to Python 3.\\n") + sys.stderr.flush() + del sys """ % (WHLVERSION) if GetTarget() == 'windows': diff --git a/makepanda/makewheel.py b/makepanda/makewheel.py index fea29bd17f..e7e143c264 100644 --- a/makepanda/makewheel.py +++ b/makepanda/makewheel.py @@ -596,10 +596,23 @@ def makewheel(version, output_dir, platform=None): # Write the panda3d tree. We use a custom empty __init__ since the # default one adds the bin directory to the PATH, which we don't have. - whl.write_file_data('panda3d/__init__.py', """"Python bindings for the Panda3D libraries" + p3d_init = """"Python bindings for the Panda3D libraries" __version__ = '{0}' -""".format(version)) +""".format(version) + + if '27' in ABI_TAG: + p3d_init += """ +if __debug__: + import sys + if sys.version_info < (3, 0): + sys.stderr.write("WARNING: Python 2.7 will reach EOL after December 31, 2019.\\n") + sys.stderr.write("To suppress this warning, upgrade to Python 3.\\n") + sys.stderr.flush() + del sys +""" + + whl.write_file_data('panda3d/__init__.py', p3d_init) # Copy the extension modules from the panda3d directory. ext_suffix = GetExtensionSuffix()