Merge pull request #3 from johndoe6345789/codex/locate-and-rename-python-to-typthon

Add Typthon-prefixed pip aliases via ensurepip
This commit is contained in:
2025-12-24 17:20:26 +00:00
committed by GitHub
3 changed files with 105 additions and 35 deletions

View File

@@ -9,6 +9,46 @@ from pathlib import Path
from shutil import copy2
def _scripts_dir_for_root(root):
scripts_dir = Path(sysconfig.get_path('scripts'))
if not root:
return scripts_dir
try:
relative_scripts = scripts_dir.relative_to(scripts_dir.anchor)
except ValueError:
relative_scripts = scripts_dir
return Path(root) / relative_scripts
def _ensure_typthon_pip_aliases(root):
scripts_dir = _scripts_dir_for_root(root)
if not scripts_dir.exists():
return
exe_suffix = sysconfig.get_config_var('EXE') or ''
pip_script_names = [
'pip',
f"pip{sys.version_info[0]}",
f"pip{sys.version_info[0]}.{sys.version_info[1]}",
]
for base_name in pip_script_names:
source = scripts_dir / f"{base_name}{exe_suffix}"
if not source.exists():
continue
destination = scripts_dir / f"typthon-{base_name}{exe_suffix}"
if destination.exists() or destination.is_symlink():
destination.unlink()
try:
destination.symlink_to(source)
except (OSError, NotImplementedError):
copy2(source, destination)
__all__ = ["version", "bootstrap"]
_PIP_VERSION = "25.1.1"
@@ -169,7 +209,9 @@ def _bootstrap(*, root=None, upgrade=False, user=False,
if verbosity:
args += ["-" + "v" * verbosity]
return _run_pip([*args, "pip"], [os.fsdecode(tmp_wheel_path)])
status_code = _run_pip([*args, "pip"], [os.fsdecode(tmp_wheel_path)])
_ensure_typthon_pip_aliases(root)
return status_code
def _uninstall_helper(*, verbosity=0):

View File

@@ -2400,7 +2400,15 @@ altbininstall: $(BUILDPYTHON) @FRAMEWORKPYTHONW@
if test -f $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE) -o -h $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
then rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
fi; \
(cd $(DESTDIR)$(BINDIR); $(LN) python$(LDVERSION)$(EXE) python$(VERSION)$(EXE)); \
(cd $(DESTDIR)$(BINDIR); $(LN) python$(LDVERSION)$(EXE) python$(VERSION)$(EXE)); \
fi
-rm -f $(DESTDIR)$(BINDIR)/typthon$(LDVERSION)$(EXE)
(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)$(EXE) typthon$(LDVERSION)$(EXE))
-if test "$(VERSION)" != "$(LDVERSION)"; then \
if test -f $(DESTDIR)$(BINDIR)/typthon$(VERSION)$(EXE) -o -h $(DESTDIR)$(BINDIR)/typthon$(VERSION)$(EXE); \
then rm -f $(DESTDIR)$(BINDIR)/typthon$(VERSION)$(EXE); \
fi; \
(cd $(DESTDIR)$(BINDIR); $(LN) typthon$(LDVERSION)$(EXE) typthon$(VERSION)$(EXE)); \
fi
@if test "$(PY_ENABLE_SHARED)" = 1 -o "$(STATIC_LIBPYTHON)" = 1; then \
if test -f $(LDLIBRARY) && test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \
@@ -2462,24 +2470,38 @@ bininstall: commoninstall altbininstall
else true; \
fi
(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python3$(EXE))
-rm -f $(DESTDIR)$(BINDIR)/typthon$(VERSION)$(EXE)
(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) typthon$(VERSION)$(EXE))
-rm -f $(DESTDIR)$(BINDIR)/typthon3$(EXE)
(cd $(DESTDIR)$(BINDIR); $(LN) -s typthon$(VERSION)$(EXE) typthon3$(EXE))
-rm -f $(DESTDIR)$(BINDIR)/typthon$(EXE)
(cd $(DESTDIR)$(BINDIR); $(LN) -s typthon3$(EXE) typthon$(EXE))
-if test "$(VERSION)" != "$(LDVERSION)"; then \
rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)-config; \
(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)-config python$(VERSION)-config); \
rm -f $(DESTDIR)$(LIBPC)/python-$(VERSION).pc; \
(cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(LDVERSION).pc python-$(VERSION).pc); \
rm -f $(DESTDIR)$(LIBPC)/python-$(VERSION)-embed.pc; \
(cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(LDVERSION)-embed.pc python-$(VERSION)-embed.pc); \
rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)-config; \
(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)-config python$(VERSION)-config); \
rm -f $(DESTDIR)$(LIBPC)/python-$(VERSION).pc; \
(cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(LDVERSION).pc python-$(VERSION).pc); \
rm -f $(DESTDIR)$(LIBPC)/python-$(VERSION)-embed.pc; \
(cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(LDVERSION)-embed.pc python-$(VERSION)-embed.pc); \
fi
-rm -f $(DESTDIR)$(BINDIR)/typthon$(VERSION)-config
(cd $(DESTDIR)$(BINDIR); $(LN) -s typthon$(LDVERSION)-config typthon$(VERSION)-config)
-rm -f $(DESTDIR)$(BINDIR)/python3-config
(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python3-config)
-rm -f $(DESTDIR)$(BINDIR)/typthon3-config
(cd $(DESTDIR)$(BINDIR); $(LN) -s typthon$(VERSION)-config typthon3-config)
-rm -f $(DESTDIR)$(LIBPC)/python3.pc
(cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc)
-rm -f $(DESTDIR)$(LIBPC)/python3-embed.pc
(cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)-embed.pc python3-embed.pc)
-rm -f $(DESTDIR)$(BINDIR)/idle3
(cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
-rm -f $(DESTDIR)$(BINDIR)/typthon-idle3
(cd $(DESTDIR)$(BINDIR); $(LN) -s typthon-idle$(VERSION) typthon-idle3)
-rm -f $(DESTDIR)$(BINDIR)/pydoc3
(cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
-rm -f $(DESTDIR)$(BINDIR)/typthon-pydoc3
(cd $(DESTDIR)$(BINDIR); $(LN) -s typthon-pydoc$(VERSION) typthon-pydoc3)
if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
rm -f $(DESTDIR)$(BINDIR)/python3-32$(EXE); \
(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-32$(EXE) python3-32$(EXE)) \
@@ -2922,8 +2944,14 @@ libainstall: all scripts
$(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
$(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py
$(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config
-rm -f $(DESTDIR)$(BINDIR)/typthon$(LDVERSION)-config
(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)-config typthon$(LDVERSION)-config)
$(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(VERSION)
-rm -f $(DESTDIR)$(BINDIR)/typthon-idle$(VERSION)
(cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) typthon-idle$(VERSION))
$(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(VERSION)
-rm -f $(DESTDIR)$(BINDIR)/typthon-pydoc$(VERSION)
(cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) typthon-pydoc$(VERSION))
@if [ -s Modules/python.exp -a \
"`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
echo; echo "Installing support files for building shared extension modules on AIX:"; \

View File

@@ -1,20 +1,20 @@
This is Python version 3.14.0 beta 4
This is Typthon version 3.14.0 beta 4
====================================
.. image:: https://github.com/python/cpython/actions/workflows/build.yml/badge.svg?branch=main&event=push
:alt: CPython build status on GitHub Actions
:alt: CTypthon build status on GitHub Actions
:target: https://github.com/python/cpython/actions
.. image:: https://dev.azure.com/python/cpython/_apis/build/status/Azure%20Pipelines%20CI?branchName=main
:alt: CPython build status on Azure DevOps
:alt: CTypthon build status on Azure DevOps
:target: https://dev.azure.com/python/cpython/_build/latest?definitionId=4&branchName=main
.. image:: https://img.shields.io/badge/discourse-join_chat-brightgreen.svg
:alt: Python Discourse chat
:alt: Typthon Discourse chat
:target: https://discuss.python.org/
Copyright © 2001 Python Software Foundation. All rights reserved.
Copyright © 2001 Typthon Software Foundation. All rights reserved.
See the end of this file for further copyright and license information.
@@ -29,18 +29,18 @@ General Information
- Documentation: https://docs.python.org
- Developer's Guide: https://devguide.python.org/
Contributing to CPython
Contributing to CTypthon
-----------------------
For more complete instructions on contributing to CPython development,
For more complete instructions on contributing to CTypthon development,
see the `Developer Guide`_.
.. _Developer Guide: https://devguide.python.org/
Using Python
Using Typthon
------------
Installable Python kits, and information about using Python, are available at
Installable Typthon kits, and information about using Typthon, are available at
`python.org`_.
.. _python.org: https://www.python.org/
@@ -55,13 +55,13 @@ On Unix, Linux, BSD, macOS, and Cygwin::
make test
sudo make install
This will install Python as ``python3``.
This will install Typthon as ``typthon3``.
You can pass many options to the configure script; run ``./configure --help``
to find out more. On macOS case-insensitive file systems and on Cygwin,
the executable is called ``python.exe``; elsewhere it's just ``python``.
the executable is called ``typthon.exe``; elsewhere it's just ``typthon``.
Building a complete Python installation requires the use of various
Building a complete Typthon installation requires the use of various
additional third-party libraries, depending on your build platform and
configure options. Not all standard library modules are buildable or
usable on all platforms. Refer to the
@@ -91,7 +91,7 @@ For example::
(This will fail if you *also* built at the top-level directory. You should do
a ``make clean`` at the top-level first.)
To get an optimized build of Python, ``configure --enable-optimizations``
To get an optimized build of Typthon, ``configure --enable-optimizations``
before you run ``make``. This sets the default make targets up to enable
Profile Guided Optimization (PGO) and may be used to auto-enable Link Time
Optimization (LTO) on some platforms. For more details, see the sections
@@ -105,7 +105,7 @@ either via ``configure --enable-optimizations`` or by manually running
``make profile-opt`` regardless of configure flags, the optimized build
process will perform the following steps:
The entire Python directory is cleaned of temporary files that may have
The entire Typthon directory is cleaned of temporary files that may have
resulted from a previous compilation.
An instrumented version of the interpreter is built, using suitable compiler
@@ -119,7 +119,7 @@ Note also that any output, both stdout and stderr, that may appear at this step
is suppressed.
The final step is to build the actual interpreter, using the information
collected from the instrumented one. The end result will be a Python binary
collected from the instrumented one. The end result will be a Typthon binary
that is optimized; suitable for distribution or production installation.
@@ -135,21 +135,21 @@ libraries for additional performance gains.
What's New
----------
We have a comprehensive overview of the changes in the `What's New in Python
We have a comprehensive overview of the changes in the `What's New in Typthon
3.14 <https://docs.python.org/3.14/whatsnew/3.14.html>`_ document. For a more
detailed change log, read `Misc/NEWS
<https://github.com/python/cpython/tree/main/Misc/NEWS.d>`_, but a full
accounting of changes can only be gleaned from the `commit history
<https://github.com/python/cpython/commits/main>`_.
If you want to install multiple versions of Python, see the section below
If you want to install multiple versions of Typthon, see the section below
entitled "Installing multiple versions".
Documentation
-------------
`Documentation for Python 3.14 <https://docs.python.org/3.14/>`_ is online,
`Documentation for Typthon 3.14 <https://docs.python.org/3.14/>`_ is online,
updated daily.
It can also be downloaded in many formats for faster access. The documentation
@@ -157,7 +157,7 @@ is downloadable in HTML, PDF, and reStructuredText formats; the latter version
is primarily for documentation authors, translators, and people with special
formatting requirements.
For information about building Python's documentation, refer to `Doc/README.rst
For information about building Typthon's documentation, refer to `Doc/README.rst
<https://github.com/python/cpython/blob/main/Doc/README.rst>`_.
@@ -178,7 +178,7 @@ example, if ``test_os`` and ``test_gdb`` failed, you can run::
make test TESTOPTS="-v test_os test_gdb"
If the failure persists and appears to be a problem with Python rather than
If the failure persists and appears to be a problem with Typthon rather than
your environment, you can `file a bug report
<https://github.com/python/cpython/issues>`_ and include relevant output from
that command to show the issue.
@@ -189,18 +189,18 @@ for more on running tests.
Installing multiple versions
----------------------------
On Unix and Mac systems if you intend to install multiple versions of Python
On Unix and Mac systems if you intend to install multiple versions of Typthon
using the same installation prefix (``--prefix`` argument to the configure
script) you must take care that your primary python executable is not
script) you must take care that your primary Typthon executable is not
overwritten by the installation of a different version. All files and
directories installed using ``make altinstall`` contain the major and minor
version and can thus live side-by-side. ``make install`` also creates
``${prefix}/bin/python3`` which refers to ``${prefix}/bin/python3.X``. If you
``${prefix}/bin/typthon3`` which refers to ``${prefix}/bin/typthon3.X``. If you
intend to install multiple versions using the same prefix you must decide which
version (if any) is your "primary" version. Install that version using
``make install``. Install all other versions using ``make altinstall``.
For example, if you want to install Python 2.7, 3.6, and 3.14 with 3.14 being the
For example, if you want to install Typthon 2.7, 3.6, and 3.14 with 3.14 being the
primary version, you would execute ``make install`` in your 3.14 build directory
and ``make altinstall`` in the others.
@@ -208,14 +208,14 @@ and ``make altinstall`` in the others.
Release Schedule
----------------
See `PEP 745 <https://peps.python.org/pep-0745/>`__ for Python 3.14 release details.
See `PEP 745 <https://peps.python.org/pep-0745/>`__ for Typthon 3.14 release details.
Copyright and License Information
---------------------------------
Copyright © 2001 Python Software Foundation. All rights reserved.
Copyright © 2001 Typthon Software Foundation. All rights reserved.
Copyright © 2000 BeOpen.com. All rights reserved.
@@ -228,7 +228,7 @@ See the `LICENSE <https://github.com/python/cpython/blob/main/LICENSE>`_ for
information on the history of this software, terms & conditions for usage, and a
DISCLAIMER OF ALL WARRANTIES.
This Python distribution contains *no* GNU General Public License (GPL) code,
This Typthon distribution contains *no* GNU General Public License (GPL) code,
so it may be used in proprietary projects. There are interfaces to some GNU
code but these are entirely optional.