Commit 735a66a5 authored by Ofekmeister's avatar Ofekmeister

Make import unconditional

Put import on top and updated CHANGES.rst
parent 9e11ba01
...@@ -5,6 +5,9 @@ CHANGES ...@@ -5,6 +5,9 @@ CHANGES
v25.4.0 v25.4.0
------- -------
* #459 via #736: On Windows systems, sys.argv[0] now correctly becomes the
name of entry point.
* Add Extension(py_limited_api=True). When set to a truthy value, * Add Extension(py_limited_api=True). When set to a truthy value,
that extension gets a filename apropriate for code using Py_LIMITED_API. that extension gets a filename apropriate for code using Py_LIMITED_API.
When used correctly this allows a single compiled extension to work on When used correctly this allows a single compiled extension to work on
......
...@@ -2018,11 +2018,11 @@ class ScriptWriter(object): ...@@ -2018,11 +2018,11 @@ class ScriptWriter(object):
template = textwrap.dedent(""" template = textwrap.dedent("""
# EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r # EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r
__requires__ = %(spec)r __requires__ = %(spec)r
import re
import sys import sys
from pkg_resources import load_entry_point from pkg_resources import load_entry_point
if __name__ == '__main__': if __name__ == '__main__':
import re
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit( sys.exit(
load_entry_point(%(spec)r, %(group)r, %(name)r)() load_entry_point(%(spec)r, %(group)r, %(name)r)()
......
...@@ -74,11 +74,11 @@ class TestEasyInstallTest: ...@@ -74,11 +74,11 @@ class TestEasyInstallTest:
expected = header + DALS(""" expected = header + DALS("""
# EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name' # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
__requires__ = 'spec' __requires__ = 'spec'
import re
import sys import sys
from pkg_resources import load_entry_point from pkg_resources import load_entry_point
if __name__ == '__main__': if __name__ == '__main__':
import re
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit( sys.exit(
load_entry_point('spec', 'console_scripts', 'name')() load_entry_point('spec', 'console_scripts', 'name')()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment