Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a 'python.bat' script to invoke interpreter from source root #64161

Closed
zware opened this issue Dec 12, 2013 · 5 comments
Closed

Create a 'python.bat' script to invoke interpreter from source root #64161

zware opened this issue Dec 12, 2013 · 5 comments
Assignees
Labels
build The build process and cross-build OS-windows type-feature A feature request or enhancement

Comments

@zware
Copy link
Member

zware commented Dec 12, 2013

BPO 19962
Nosy @loewis, @terryjreedy, @tjguk, @briancurtin, @zware
Files
  • python.bat.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/zware'
    closed_at = <Date 2014-04-30.21:15:26.319>
    created_at = <Date 2013-12-12.15:33:49.713>
    labels = ['type-feature', 'OS-windows', 'build']
    title = "Create a 'python.bat' script to invoke interpreter from source root"
    updated_at = <Date 2014-04-30.21:15:26.318>
    user = 'https://github.com/zware'

    bugs.python.org fields:

    activity = <Date 2014-04-30.21:15:26.318>
    actor = 'zach.ware'
    assignee = 'zach.ware'
    closed = True
    closed_date = <Date 2014-04-30.21:15:26.319>
    closer = 'zach.ware'
    components = ['Build', 'Windows']
    creation = <Date 2013-12-12.15:33:49.713>
    creator = 'zach.ware'
    dependencies = []
    files = ['33103']
    hgrepos = []
    issue_num = 19962
    keywords = ['patch']
    message_count = 5.0
    messages = ['205957', '215294', '216547', '217650', '217657']
    nosy_count = 6.0
    nosy_names = ['loewis', 'terry.reedy', 'tim.golden', 'brian.curtin', 'python-dev', 'zach.ware']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue19962'
    versions = ['Python 3.5']

    @zware
    Copy link
    Member Author

    zware commented Dec 12, 2013

    The attached patch adds a CustomBuildStep to python.vcxproj which creates a 'python.bat' script in the root of the source tree for quicker and easier invocation for testing purposes, and to make the Windows Python developer experience a little closer to the UNIX experience. Sample output:

    """
    C:\path\to\cpython>type python.bat
    @Rem This script invokes the most recently built Python with all arguments
    @Rem passed through to the interpreter. This file is generated by the
    @Rem build process and any changes *will* be thrown away by the next
    @Rem rebuild.
    @Rem This is only meant as a convenience for developing CPython
    @Rem and using it outside of that context is ill-advised.
    @echo Running Debug^|Win32 interpreter...
    @"C:\path\to\cpython\PCbuild\python_d.exe" %*

    C:\path\to\cpython>python -c "import sys;print(sys.version)"
    Running Debug|Win32 interpreter...
    3.4.0b1 (default:6864abd8e83a+, Dec 12 2013, 08:35:32) [MSC v.1600 32 bit (Intel
    )]
    """

    As the commentary (which can likely be improved) states, the script is re-created by every rebuild, so it always points to the most recently built interpreter. Also, being a CustomBuildStep, it is cleaned up automatically by the Clean build target.

    I'm not sure whether echoing the interpreter configuration is the best idea, but I personally prefer that over echoing the full command which has the potential to be very long. I think that the Configuration/Platform should be displayed somehow to reduce confusion since there could be up to 8 different interpreters living together in PCbuild (not to mention PC/VS10.0, when it exists someday) and python.bat will only point to one of them.

    Note that the x64 changes are done by hand and untested; I don't have the ability to do so just yet.

    @zware zware self-assigned this Dec 12, 2013
    @zware zware added build The build process and cross-build OS-windows type-feature A feature request or enhancement labels Dec 12, 2013
    @zware
    Copy link
    Member Author

    zware commented Apr 1, 2014

    This appears to work correctly for PGO builds and x64 builds. Does anyone have any objections to this, or suggestions for improvement?

    @tjguk
    Copy link
    Member

    tjguk commented Apr 16, 2014

    +1

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Apr 30, 2014

    New changeset de35f6a3b292 by Zachary Ware in branch 'default':
    Issue bpo-19962: The Windows build process now creates "python.bat"
    http://hg.python.org/cpython/rev/de35f6a3b292

    @zware
    Copy link
    Member Author

    zware commented Apr 30, 2014

    Thanks for the up-vote, Tim :)

    @zware zware closed this as completed Apr 30, 2014
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    build The build process and cross-build OS-windows type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants