Skip to content

Commit 9a2f2ca

Browse files
authored
Merge pull request winpython#930 from stonebig/master
trying to open in the "desired" directory for idle/spyder/jupyter
2 parents b187444 + 55eafcd commit 9a2f2ca

File tree

2 files changed

+53
-46
lines changed

2 files changed

+53
-46
lines changed

make.py

+52-45
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,13 @@ def _create_batch_scripts_initial(self):
13261326
r"""@echo off
13271327
call "%~dp0env.bat"
13281328
set WINPYWORKDIR=%~dp0..\Notebooks
1329+
1330+
set WINPYWORKDIR1=%~dp1
1331+
if "%WINPYWORKDIR1%"=="" (
1332+
if not "%CD%\"=="%~dp0" set WINPYWORKDIR1=%CD%
1333+
)
1334+
if "%WINPYWORKDIR1%"=="" set WINPYWORKDIR1=%WINPYWORKDIR%
1335+
13291336
FOR /F "delims=" %%i IN ('cscript /nologo "%~dp0WinpythonIni.vbs"') DO set winpythontoexec=%%i
13301337
%winpythontoexec%set winpythontoexec=
13311338
@@ -1549,14 +1556,14 @@ def _create_batch_scripts(self):
15491556
self.create_batch_script(
15501557
'cmd.bat',
15511558
r"""@echo off
1552-
call "%~dp0env_for_icons.bat"
1559+
call "%~dp0env_for_icons.bat" %*
15531560
cmd.exe /k""",
15541561
)
15551562

15561563
self.create_batch_script(
15571564
'python.bat',
15581565
r"""@echo off
1559-
call "%~dp0env_for_icons.bat"
1566+
call "%~dp0env_for_icons.bat" %*
15601567
rem backward compatibility for python command-line users
15611568
"%WINPYDIR%\python.exe" %*
15621569
""",
@@ -1565,8 +1572,8 @@ def _create_batch_scripts(self):
15651572
self.create_batch_script(
15661573
'winpython.bat',
15671574
r"""@echo off
1568-
call "%~dp0env_for_icons.bat"
1569-
cd/D "%WINPYWORKDIR%"
1575+
call "%~dp0env_for_icons.bat" %*
1576+
cd/D "%WINPYWORKDIR1%"
15701577
rem backward compatibility for non-ptpython users
15711578
if exist "%WINPYDIR%\scripts\ptpython.exe" (
15721579
"%WINPYDIR%\scripts\ptpython.exe" %*
@@ -1579,7 +1586,7 @@ def _create_batch_scripts(self):
15791586
self.create_batch_script(
15801587
'idlex.bat',
15811588
r"""@echo off
1582-
call "%~dp0env_for_icons.bat"
1589+
call "%~dp0env_for_icons.bat" %*
15831590
rem backward compatibility for non-IDLEX users
15841591
if exist "%WINPYDIR%\scripts\idlex.pyw" (
15851592
"%WINPYDIR%\python.exe" "%WINPYDIR%\scripts\idlex.pyw" %*
@@ -1592,16 +1599,17 @@ def _create_batch_scripts(self):
15921599
self.create_batch_script(
15931600
'idle.bat',
15941601
r"""@echo off
1595-
call "%~dp0env_for_icons.bat"
1602+
call "%~dp0env_for_icons.bat" %*
15961603
"%WINPYDIR%\python.exe" "%WINPYDIR%\Lib\idlelib\idle.pyw" %*
15971604
15981605
""",
15991606
)
16001607
self.create_batch_script(
16011608
'winidlex.bat',
16021609
r"""@echo off
1603-
call "%~dp0env_for_icons.bat"
1604-
cd/D "%WINPYWORKDIR%"
1610+
1611+
call "%~dp0env_for_icons.bat" %*
1612+
cd/D "%WINPYWORKDIR1%"
16051613
rem backward compatibility for non-IDLEX users
16061614
if exist "%WINPYDIR%\scripts\idlex.pyw" (
16071615
"%WINPYDIR%\python.exe" "%WINPYDIR%\scripts\idlex.pyw" %*
@@ -1613,42 +1621,41 @@ def _create_batch_scripts(self):
16131621
self.create_batch_script(
16141622
'winidle.bat',
16151623
r"""@echo off
1616-
call "%~dp0env_for_icons.bat"
1617-
cd/D "%WINPYWORKDIR%"
1624+
call "%~dp0env_for_icons.bat" %*
1625+
cd/D "%WINPYWORKDIR1%"
16181626
"%WINPYDIR%\python.exe" "%WINPYDIR%\Lib\idlelib\idle.pyw" %*
16191627
""",
16201628
)
16211629

16221630
self.create_batch_script(
16231631
'spyder.bat',
16241632
r"""@echo off
1625-
call "%~dp0env_for_icons.bat"
1626-
cd/D "%WINPYWORKDIR%"
1633+
call "%~dp0env_for_icons.bat" %*
1634+
rem cd/D "%WINPYWORKDIR%"
16271635
if exist "%WINPYDIR%\scripts\spyder3.exe" (
1628-
"%WINPYDIR%\scripts\spyder3.exe" %*
1636+
"%WINPYDIR%\scripts\spyder3.exe" %* -w "%WINPYWORKDIR1%"
16291637
) else (
1630-
"%WINPYDIR%\scripts\spyder.exe" %*
1631-
)
1638+
"%WINPYDIR%\scripts\spyder.exe" %* -w "%WINPYWORKDIR1%"
1639+
)
16321640
""",
16331641
)
16341642
self.create_batch_script(
16351643
'winspyder.bat',
16361644
r"""@echo off
1637-
call "%~dp0env_for_icons.bat"
1638-
cd/D "%WINPYWORKDIR%"
1645+
call "%~dp0env_for_icons.bat" %*
1646+
rem cd/D "%WINPYWORKDIR%"
16391647
if exist "%WINPYDIR%\scripts\spyder3.exe" (
1640-
"%WINPYDIR%\scripts\spyder3.exe" %*
1648+
"%WINPYDIR%\scripts\spyder3.exe" %* -w "%WINPYWORKDIR1%"
16411649
) else (
1642-
"%WINPYDIR%\scripts\spyder.exe" %*
1643-
)
1650+
"%WINPYDIR%\scripts\spyder.exe" %* -w "%WINPYWORKDIR1%"
16441651
""",
16451652
)
16461653

16471654
self.create_batch_script(
16481655
'spyder_reset.bat',
16491656
r"""@echo off
1650-
call "%~dp0env_for_icons.bat"
1651-
cd/D "%WINPYWORKDIR%"
1657+
call "%~dp0env_for_icons.bat" %*
1658+
cd/D "%WINPYWORKDIR1%"
16521659
if exist "%WINPYDIR%\scripts\spyder3.exe" (
16531660
"%WINPYDIR%\scripts\spyder3.exe" --reset %*
16541661
) else (
@@ -1660,53 +1667,53 @@ def _create_batch_scripts(self):
16601667
self.create_batch_script(
16611668
'ipython_notebook.bat',
16621669
r"""@echo off
1663-
call "%~dp0env_for_icons.bat"
1664-
cd/D "%WINPYWORKDIR%"
1670+
call "%~dp0env_for_icons.bat" %*
1671+
cd/D "%WINPYWORKDIR1%"
16651672
"%WINPYDIR%\scripts\jupyter-notebook.exe" %*
16661673
""",
16671674
)
16681675

16691676
self.create_batch_script(
16701677
'winipython_notebook.bat',
16711678
r"""@echo off
1672-
call "%~dp0env_for_icons.bat"
1673-
cd/D "%WINPYWORKDIR%"
1679+
call "%~dp0env_for_icons.bat" %*
1680+
cd/D "%WINPYWORKDIR1%"
16741681
"%WINPYDIR%\scripts\jupyter-notebook.exe" %*
16751682
""",
16761683
)
16771684

16781685
self.create_batch_script(
16791686
'winjupyter_lab.bat',
16801687
r"""@echo off
1681-
call "%~dp0env_for_icons.bat"
1682-
cd/D "%WINPYWORKDIR%"
1688+
call "%~dp0env_for_icons.bat" %*
1689+
cd/D "%WINPYWORKDIR1%"
16831690
"%WINPYDIR%\scripts\jupyter-lab.exe" %*
16841691
""",
16851692
)
16861693

16871694
self.create_batch_script(
16881695
'qtconsole.bat',
16891696
r"""@echo off
1690-
call "%~dp0env_for_icons.bat"
1691-
cd/D "%WINPYWORKDIR%"
1697+
call "%~dp0env_for_icons.bat" %*
1698+
cd/D "%WINPYWORKDIR1%"
16921699
"%WINPYDIR%\scripts\jupyter-qtconsole.exe" %*
16931700
""",
16941701
)
16951702

16961703
self.create_batch_script(
16971704
'winqtconsole.bat',
16981705
r"""@echo off
1699-
call "%~dp0env_for_icons.bat"
1700-
cd/D "%WINPYWORKDIR%"
1706+
call "%~dp0env_for_icons.bat" %*
1707+
cd/D "%WINPYWORKDIR1%"
17011708
"%WINPYDIR%\scripts\jupyter-qtconsole.exe" %*
17021709
""",
17031710
)
17041711

17051712
self.create_batch_script(
17061713
'qtdemo.bat',
17071714
r"""@echo off
1708-
call "%~dp0env_for_icons.bat"
1709-
cd/D "%WINPYWORKDIR%"
1715+
call "%~dp0env_for_icons.bat" %*
1716+
cd/D "%WINPYWORKDIR1%"
17101717
if exist "%WINPYDIR%\Lib\site-packages\PyQt5\examples\qtdemo\qtdemo.py" (
17111718
"%WINPYDIR%\python.exe" "%WINPYDIR%\Lib\site-packages\PyQt5\examples\qtdemo\qtdemo.py"
17121719
)
@@ -1719,8 +1726,8 @@ def _create_batch_scripts(self):
17191726
self.create_batch_script(
17201727
'qtdesigner.bat',
17211728
r"""@echo off
1722-
call "%~dp0env_for_icons.bat"
1723-
cd/D "%WINPYWORKDIR%"
1729+
call "%~dp0env_for_icons.bat" %*
1730+
cd/D "%WINPYWORKDIR1%"
17241731
if "%QT_API%"=="" ( set QT_API=pyqt5 )
17251732
if "%QT_API%"=="pyqt5" (
17261733
if exist "%WINPYDIR%\Scripts\designer.exe" (
@@ -1743,8 +1750,8 @@ def _create_batch_scripts(self):
17431750
self.create_batch_script(
17441751
'qtassistant.bat',
17451752
r"""@echo off
1746-
call "%~dp0env_for_icons.bat"
1747-
cd/D "%WINPYWORKDIR%"
1753+
call "%~dp0env_for_icons.bat" %*
1754+
cd/D "%WINPYWORKDIR1%"
17481755
if "%QT_API%"=="" ( set QT_API=pyqt5 )
17491756
if "%QT_API%"=="pyqt5" (
17501757
if exist "%WINPYDIR%\Scripts\assistant.exe" (
@@ -1767,8 +1774,8 @@ def _create_batch_scripts(self):
17671774
self.create_batch_script(
17681775
'qtlinguist.bat',
17691776
r"""@echo off
1770-
call "%~dp0env_for_icons.bat"
1771-
cd/D "%WINPYWORKDIR%"
1777+
call "%~dp0env_for_icons.bat" %*
1778+
cd/D "%WINPYWORKDIR1%"
17721779
if "%QT_API%"=="" ( set QT_API=pyqt5 )
17731780
if "%QT_API%"=="pyqt5" (
17741781
if exist "%WINPYDIR%\Scripts\linguist.exe" (
@@ -1805,8 +1812,8 @@ def _create_batch_scripts(self):
18051812
self.create_batch_script(
18061813
'wpcp.bat',
18071814
r"""@echo off
1808-
call "%~dp0env_for_icons.bat"
1809-
cd/D "%WINPYWORKDIR%"
1815+
call "%~dp0env_for_icons.bat" %*
1816+
cd/D "%WINPYWORKDIR1%"
18101817
"%WINPYDIR%\python.exe" -m winpython.controlpanel %*
18111818
""",
18121819
)
@@ -1829,7 +1836,7 @@ def _create_batch_scripts(self):
18291836
self.create_batch_script(
18301837
'winpyzo.bat',
18311838
r"""@echo off
1832-
call "%~dp0env_for_icons.bat"
1839+
call "%~dp0env_for_icons.bat" %*
18331840
cd/D "%WINPYDIR%"
18341841
"%WINPYDIR%\scripts\pyzo.exe" %*
18351842
""",
@@ -1853,8 +1860,8 @@ def _create_batch_scripts(self):
18531860
'winvscode.bat',
18541861
r"""@echo off
18551862
rem launcher for VScode
1856-
call "%~dp0env_for_icons.bat"
1857-
rem cd/D "%WINPYWORKDIR%"
1863+
call "%~dp0env_for_icons.bat" %*
1864+
rem cd/D "%WINPYWORKDIR1%"
18581865
if exist "%WINPYDIR%\..\t\vscode\code.exe" (
18591866
"%WINPYDIR%\..\t\vscode\code.exe" %*
18601867
) else (

winpython/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
OTHER DEALINGS IN THE SOFTWARE.
2929
"""
3030

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

0 commit comments

Comments
 (0)