8000 Merge pull request #845 from stonebig/master · winpython/winpython@4bc9d79 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4bc9d79

Browse files
authored
Merge pull request #845 from stonebig/master
improve VSCode Support + ease Python-3.8 isolation
2 parents 93a6f9a + 79a8d24 commit 4bc9d79

File tree

4 files changed

+103
-3
lines changed

4 files changed

+103
-3
lines changed

make.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ def get_tool_path(relpath, checkfunc):
385385
installed_tools += [('Nodejs', nodever)]
386386
npmver = utils.get_npmjs_version(nodepath)
387387
installed_tools += [('npmjs', npmver)]
388+
388389
pandocexe = get_tool_path(
389390
r'\t\pandoc.exe', osp.isfile
390391
)
@@ -393,6 +394,12 @@ def get_tool_path(relpath, checkfunc):
393394
osp.dirname(pandocexe)
394395
)
395396
installed_tools += [('Pandoc', pandocver)]
397+
398+
vscodeexe = get_tool_path(r'\t\VSCode\Code.exe', osp.isfile)
399+
if vscodeexe is not None:
400+
installed_tools += [('VSCode',
401+
utils.getFileProperties(vscodeexe)['FileVersion'])]
402+
396403
tools = []
397404
for name, ver in installed_tools:
398405
metadata = wppm.get_package_metadata(
@@ -1006,7 +1013,8 @@ def _create_batch_scripts_initial(self):
10061013
+ self.winpyver
10071014
+ r"""
10081015
set HOME=%WINPYDIRBASE%\settings
1009-
set USERPROFILE=%HOME%
1016+
rem read https://github.com/winpython/winpython/issues/839
1017+
rem set USERPROFILE=%HOME%
10101018
rem set WINPYDIRBASE=
10111019
set JUPYTER_DATA_DIR=%HOME%
10121020
set WINPYARCH=WIN32
@@ -1093,6 +1101,7 @@ def _create_batch_scripts_initial(self):
10931101
rem WinPython.ini part (removed from nsis)
10941102
rem ******************
10951103
if not exist "%WINPYDIRBASE%\settings" mkdir "%WINPYDIRBASE%\settings"
1104+
if not exist "%WINPYDIRBASE%\settings\Roaming" mkdir "%WINPYDIRBASE%\settings\Roaming"
10961105
set winpython_ini=%WINPYDIRBASE%\settings\winpython.ini
10971106
if not exist "%winpython_ini%" (
10981107
echo [debug]
@@ -1144,7 +1153,10 @@ def _create_batch_scripts_initial(self):
11441153
+ self.winpyver
11451154
+ r"""'
11461155
$env:HOME = "$env:WINPYDIRBASE\settings"
1147-
$env:USERPROFILE = "$env:HOME"
1156+
1157+
# rem read https://github.com/winpython/winpython/issues/839
1158+
# $env:USERPROFILE = "$env:HOME"
1159+
11481160
$env:WINPYDIRBASE = ""
11491161
$env:JUPYTER_DATA_DIR = "$env:HOME"
11501162
$env:WINPYARCH = 'WIN32'
@@ -1232,6 +1244,7 @@ def _create_batch_scripts_initial(self):
12321244
### WinPython.ini part (removed from nsis)
12331245
#####################
12341246
if (-not (Test-Path "$env:WINPYDIR\..\settings")) { md -Path "$env:WINPYDIR\..\settings" }
1247+
if (-not (Test-Path "$env:WINPYDIR\..\settings\Roaming")) { md -Path "$env:WINPYDIR\..\settings\Roaming" }
12351248
$env:winpython_ini = "$env:WINPYDIR\..\settings\winpython.ini"
12361249
if (-not (Test-Path $env:winpython_ini)) {
12371250
"[debug]" | Add-Content -Path $env:winpython_ini
@@ -1894,6 +1907,7 @@ def make(
18941907
# scripts before using an executable launcher, because the latter
18951908
# is creating the directory automatically)
18961909
os.mkdir(osp.join(self.winpydir, 'settings'))
1910+
os.mkdir(osp.join(self.winpydir, 'settings', 'Roaming'))
18971911
self._print_done()
18981912

18991913
if remove_existing and not self.simulation:

winpython/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
OTHER DEALINGS IN THE SOFTWARE.
2929
"""
3030

31-
__version__ = '2.4.20200417'
31+
__version__ = '2.4.20200425'
3232
__license__ = __doc__
3333
__project_url__ = 'http://winpython.github.io/'

winpython/data/packages.ini

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2554,3 +2554,48 @@ description = Distribution utilities
25542554
[flask-sqlalchemy]
25552555
description = Adds SQLAlchemy support to your Flask application.
25562556
2557+
[pipdeptree]
2558+
description = Command line utility to show dependency tree of packages
2559+
2560+
[flask-smorest]
2561+
description = Flask/Marshmallow-based REST API framework
2562+
2563+
[webargs]
2564+
description = Declarative parsing and validation of HTTP request objects, with built-in support for popular web frameworks, including Flask, Django, Bottle, Tornado, Pyramid, webapp2, Falcon, and aiohttp.
2565+
2566+
[pytest-trio]
2567+
description = Pytest plugin for trio
2568+
2569+
[poetry]
2570+
description = Python dependency management and packaging made easy.
2571+
2572+
[tomlkit]
2573+
description = Style preserving TOML library
2574+
2575+
[cachy]
2576+
description = Cachy provides a simple yet effective caching library.
2577+
2578+
[cachecontrol]
2579+
description = httplib2 caching for requests
2580+
2581+
[cleo]
2582+
description = Cleo allows you to create beautiful and testable command-line interfaces.
2583+
2584+
[shellingham]
2585+
description = Tool to Detect Surrounding Shell
2586+
2587+
[clikit]
2588+
description = CliKit is a group of utilities to build beautiful and testable command line interfaces.
2589+
2590+
[lockfile]
2591+
description = Platform-independent file locking module
2592+
2593+
[pylev]
2594+
description = A pure Python Levenshtein implementation that's not freaking GPL'd.
2595+
2596+
[pastel]
2597+
description = Bring colors to your terminal.
2598+
2599+
[mergedeep]
2600+
description = A deep merge function for 🐍.
2601+

winpython/utils.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,47 @@ def set_env(name, value, current=True):
113113
)
114114

115115

116+
#==============================================================================
117+
# https://stackoverflow.com/questions/580924/how-to-access-a-files-properties-on-windows
118+
def getFileProperties(fname):
119+
#==============================================================================
120+
"""
121+
Read all properties of the given file return them as a dictionary.
122+
"""
123+
import win32api
124+
propNames = ('Comments', 'InternalName', 'ProductName',
125+
'CompanyName', 'LegalCopyright', 'ProductVersion',
126+
'FileDescription', 'LegalTrademarks', 'PrivateBuild',
127+
'FileVersion', 'OriginalFilename', 'SpecialBuild')
128+
129+
props = {'FixedFileInfo': None, 'StringFileInfo': None, 'FileVersion': None}
130+
131+
try:
132+
# backslash as parm returns dictionary of numeric info corresponding to VS_FIXEDFILEINFO struc
133+
fixedInfo = win32api.GetFileVersionInfo(fname, '\\')
134+
props['FixedFileInfo'] = fixedInfo
135+
props['FileVersion'] = "%d.%d.%d.%d" % (fixedInfo['FileVersionMS'] / 65536,
136+
fixedInfo['FileVersionMS'] % 65536, fixedInfo['FileVersionLS'] / 65536,
137+
fixedInfo['FileVersionLS'] % 65536)
138+
139+
# \VarFileInfo\Translation returns list of available (language, codepage)
140+
# pairs that can be used to retreive string info. We are using only the first pair.
141+
lang, codepage = win32api.GetFileVersionInfo(fname, '\\VarFileInfo\\Translation')[0]
142+
143+
# any other must be of the form \StringfileInfo\%04X%04X\parm_name, middle
144+
# two are language/codepage pair returned from above
145+
146+
strInfo = {}
147+
for propName in propNames:
148+
strInfoPath = u'\\StringFileInfo\\%04X%04X\\%s' % (lang, codepage, propName)
149+
## print str_info
150+
strInfo[propName] = win32api.GetFileVersionInfo(fname, strInfoPath)
151+
152+
props['StringFileInfo'] = strInfo
153+
except:
154+
pass
155+
156+
return props
116157
# =============================================================================
117158
# Shortcuts, start menu
118159
# =============================================================================

0 commit comments

Comments
 (0)
0