Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions generate_a_winpython_distro.bat
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ set my_buildenv=C:\WinPython-64bit-3.6.8.0

rem handle alpha
if "%my_release_level%"=="" set my_release_level=
rem if %my_python_target%==38 set my_release_level=b1

rem ---------
rem newAge 20191022
Expand All @@ -45,10 +44,10 @@ rem --------

if %my_python_target%==37 (
set my_python_target_release=377
set my_release=0
set my_release=1
)
if %my_python_target%==38 (
set my_python_target_release=382
set my_python_target_release=384
set my_release=0
)
if %my_python_target%==39 (
Expand Down Expand Up @@ -172,16 +171,36 @@ set path=%my_original_path%
set my_WINPYDIRBASE=%my_root_dir_for_builds%\bd%my_python_target%\bu%my_flavor%\Wpy%my_arch%-%my_python_target_release%%my_release%%my_release_level%

set WINPYDIRBASE=%my_WINPYDIRBASE%

rem D/2020-07-04: poka-yoke
if not exist %my_WINPYDIRBASE%\scripts\env.bat (
echo please check and correct my_python_target_release=%my_python_target_release%
echo in generate_a_winpython_distro.bat
echo as %my_WINPYDIRBASE%\scripts\env.bat doesnt exist
pause
exit
)
rem F/2020-07-04: poka-yoke

call %my_WINPYDIRBASE%\scripts\env.bat
set
echo beg of step 2/3
rem ok no pause

rem D/2020-07-05: install msvc_runtime before packages that may want to compile
echo pip install msvc_runtime --pre --no-index --trusted-host=None --find-links=C:\WinP\packages.srcreq --upgrade
echo pip install msvc_runtime --pre --no-index --trusted-host=None --find-links=C:\WinP\packages.srcreq --upgrade>>%my_archive_log%
pip install msvc_runtime --pre --no-index --trusted-host=None --find-links=C:\WinP\packages.srcreq --upgrade
rem F/2020-07-05: install msvc_runtime before packages that may want to compile

echo pip install -r %my_requirements% --pre --no-index --trusted-host=None --find-links=C:\WinP\packages.srcreq --upgrade
echo pip install -r %my_requirements% --pre --no-index --trusted-host=None --find-links=C:\WinP\packages.srcreq --upgrade>>%my_archive_log%

echo if pip doesn't work, check the path of %my_WINPYDIRBASE%

pip install -r %my_requirements% --pre --no-index --trusted-host=None --find-links=C:\WinP\packages.srcreq --upgrade >>%my_archive_log%
echo mid of step 2/3
rem pause


rem finalize
@echo on
Expand Down
14 changes: 1 addition & 13 deletions make.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,18 +782,6 @@ def _extract_python(self):
)
self._print_done()

def _add_msvc_files(self):
"""Adding Microsoft Visual C++ DLLs"""
print("Adding Microsoft Visual C++ DLLs" "")
msvc_version = dh.get_msvc_version(
self.distribution.version
)
for fname in dh.get_msvc_dlls(
msvc_version,
architecture=self.distribution.architecture,
):
shutil.copy(fname, self.python_dir)

def _copy_dev_tools(self):
"""Copy dev tools"""
self._print("Copying tools")
Expand Down Expand Up @@ -1945,7 +1933,7 @@ def make(

if remove_existing:
if not self.simulation:
self._add_msvc_files()
# self._add_msvc_files() # replaced per msvc_runtime package
self._create_batch_scripts_initial()
self._create_batch_scripts()
# always create all launchers (as long as it is NSIS-based)
Expand Down
19 changes: 19 additions & 0 deletions run_complement_newbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ call scripts\env.bat
@echo off


rem * ===========================
rem 2020-05-15 patch jedi-0.17.0
rem * ===========================
rem see https://github.com/davidhalter/jedi/commit/f871f5e726f796127d4cfb981726b494f056ebe9
rem as it fixes https://github.com/davidhalter/jedi/issues/1548 Use the `project` variable before setting the default value.
rem if exist "%WINPYDIR%\Lib\site-packages\jedi-0.17.0.dist-info" copy/Y "C:\WinP\tempo_fixes\Jedi-0.17.0\api\__init__.py" "%WINPYDIR%\Lib\site-packages\Jedi-0.17.0\api\__init__.py"


rem * ==========================
rem * When Python has no mingwpy
rem * ==========================
Expand Down Expand Up @@ -46,6 +54,9 @@ rem * ===========================
echo finish install of jupyterlab
rem * ===========================

rem 2020-04-10 security
rem if exist "%WINPYDIR%\Lib\site-packages\jupyterlab" "%WINPYDIR%\..\n\npm" config set ignore-scripts true

rem other suggestion from https://github.com/nteract/nteract
rem npm install -g --production windows-build-tools

Expand Down Expand Up @@ -295,6 +306,8 @@ if exist "%WINPYDIR%\Lib\site-packages\jupyterlab" (
jupyter labextension list
)

rem jupyter labextension update --all (will rebuild if needed)

rem 2018-01-15 node-gyp experience
rem npm config set python "C:\WinPython\bd27\buildZero\winpython-32bit-2.7.x.2\python-2.7.13"
rem npm config delete python
Expand Down Expand Up @@ -339,6 +352,12 @@ echo patch spyder update reflex (2019-05-18 : spyder, not spyderlib !)
rem * ====================
%WINPYDIR%\python.exe -c "from winpython.utils import patch_sourcefile;patch_sourcefile(r'%WINPYDIR%\Lib\site-packages\spyder\config\main.py', ' '+chr(39)+'check_updates_on_startup'+chr(39)+': True', ' '+chr(39)+'check_updates_on_startup'+chr(39)+': False' )"

rem * ====================
echo summary 20202-04-11
rem * ====================
pip check
if exist "%WINPYDIR%\Lib\site-packages\pipdeptree" pipdeptree


@echo on
goto the_end
Expand Down
2 changes: 1 addition & 1 deletion winpython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
OTHER DEALINGS IN THE SOFTWARE.
"""

__version__ = '2.4.20200425'
__version__ = '3.0.20200705'
__license__ = __doc__
__project_url__ = 'http://winpython.github.io/'
216 changes: 2 additions & 214 deletions winpython/disthelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,219 +122,6 @@ def try_to_remove(fname):
atexit.register(try_to_remove, osp.abspath(fname))


def get_msvc_version(python_version):
"""Return Microsoft Visual C++ version used to build this Python version"""
if python_version is None:
python_version = '2.7'
warnings.warn("assuming Python 2.7 target")
if python_version in (
'2.6',
'2.7',
'3.0',
'3.1',
'3.2',
):
# Python 2.6-2.7, 3.0-3.2 were built with Visual Studio 9.0.21022.8
# (i.e. Visual C++ 2008, not Visual C++ 2008 SP1!)
return "9.0.21022.8"
elif python_version in ('3.3', '3.4'):
# Python 3.3+ were built with Visual Studio 10.0.30319.1
# (i.e. Visual C++ 2010)
return '10.0'
elif python_version in ('3.5', '3.6'):
return '15.0'
elif python_version in ('3.7', '3.8'):
return '15.0'
elif StrictVersion(python_version) >= StrictVersion('3.9'):
return '15.0'
else:
raise RuntimeError(
"Unsupported Python version %s" % python_version
)


def get_msvc_dlls(msvc_version, architecture=None):
"""Get the list of Microsoft Visual C++ DLLs associated to
architecture and Python version, create the manifest file.

architecture: integer (32 or 64) -- if None, take the Python build arch
python_version: X.Y"""
current_architecture = (
64 if sys.maxsize > 2 ** 32 else 32
)
if architecture is None:
architecture = current_architecture
filelist = []

# simple vs2015 situation: nothing (system dll)
if msvc_version == '14.0':
return filelist
msvc_major = msvc_version.split('.')[0]
msvc_minor = msvc_version.split('.')[1]

if msvc_major == '9':
key = "1fc8b3b9a1e18e3b"
atype = "" if architecture == 64 else "win32"
arch = "amd64" if architecture == 64 else "x86"

groups = {
'CRT': (
'msvcr90.dll',
'msvcp90.dll',
'msvcm90.dll',
),
# 'OPENMP': ('vcomp90.dll',)
}

for group, dll_list in groups.items():
dlls = ''
for dll in dll_list:
dlls += ' <file name="%s" />%s' % (
dll,
os.linesep,
)
manifest = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<noInheritable/>
<assemblyIdentity
type="%(atype)s"
name="Microsoft.VC90.%(group)s"
version="%(version)s"
processorArchitecture="%(arch)s"
publicKeyToken="%(key)s"
/>
%(dlls)s</assembly>
""" % dict(
version=msvc_version,
key=key,
atype=atype,
arch=arch,
group=group,
dlls=dlls,
)

vc90man = "Microsoft.VC90.%s.manifest" % group
open(vc90man, 'w').write(manifest)
_remove_later(vc90man)
filelist += [vc90man]

winsxs = osp.join(
os.environ['windir'], 'WinSxS'
)
vcstr = '%s_Microsoft.VC90.%s_%s_%s' % (
arch,
group,
key,
msvc_version,
)
for fname in os.listdir(winsxs):
path = osp.join(winsxs, fname)
if osp.isdir(
path
) and fname.lower().startswith(
vcstr.lower()
):
for dllname in os.listdir(path):
filelist.append(
osp.join(path, dllname)
)
break
else:
raise RuntimeError(
"Microsoft Visual C++ %s DLLs version %s "
"were not found" % (group, msvc_version)
)
elif (
msvc_major == '10' or msvc_major == '15'
): # 15 for vs 2015
namelist = [
name % (msvc_major + msvc_minor)
for name in (
'msvcp%s.dll',
'msvcr%s.dll',
'vcomp%s.dll',
)
]
if msvc_major == '15' and architecture == 64:
namelist = [
name % ('14' + msvc_minor)
for name in (
'vcruntime%s.dll',
'vcruntime%s_1.dll',
'msvcp%s.dll',
'vccorlib%s.dll',
'concrt%s.dll',
'vcomp%s.dll',
)
]
if msvc_major == '15' and architecture != 64:
namelist = [
name % ('14' + msvc_minor)
for name in (
'vcruntime%s.dll',
'msvcp%s.dll',
'vccorlib%s.dll',
'concrt%s.dll',
'vcomp%s.dll',
)
]
windir = os.environ['windir']
is_64bit_windows = osp.isdir(
osp.join(windir, "SysWOW64")
)

# Reminder: WoW64 (*W*indows 32-bit *o*n *W*indows *64*-bit) is a
# subsystem of the Windows operating system capable of running 32-bit
# applications and is included on all 64-bit versions of Windows
# (source: http://en.wikipedia.org/wiki/WoW64)
#
# In other words, "SysWOW64" contains 64-bit DLL and applications,
# whereas "System32" contains 64-bit DLL and applications on a 64-bit
# system.
sysdir = "System32"
if not is_64bit_windows and architecture == 64:
raise RuntimeError(
"Can't find 64-bit MSVC DLLs on a 32-bit OS"
)
if is_64bit_windows and architecture == 32:
sysdir = "SysWOW64"
for dllname in namelist:
fname = osp.join(windir, sysdir, dllname)
print('searching', fname)
if osp.exists(fname):
filelist.append(fname)
else:
raise RuntimeError(
"Microsoft Visual C++ DLLs version %s "
"were not found" % msvc_version
)
else:
raise RuntimeError(
"Unsupported MSVC version %s" % msvc_version
)
return filelist


def create_msvc_data_files(
architecture=None, python_version=None, verbose=False
):
"""Including Microsoft Visual C++ DLLs"""
msvc_version = get_msvc_version(python_version)
filelist = get_msvc_dlls(
msvc_version, architecture=architecture
)
print(create_msvc_data_files.__doc__)
if verbose:
for name in filelist:
print(" ", name)
msvc_major = msvc_version.split('.')[0]
if msvc_major == '9':
return [("Microsoft.VC90.CRT", filelist)]
else:
return [("", filelist)]


def to_include_files(data_files):
"""Convert data_files list to include_files list

Expand Down Expand Up @@ -509,7 +296,8 @@ def setup(
self.msvc = msvc
if self.msvc:
try:
self.data_files += create_msvc_data_files()
pass # manage via msvc_runtime wheel (or give up anyway)
# self.data_files += create_msvc_data_files()
except IOError:
print(
"Setting the msvc option to False "
Expand Down