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

Add windows-terminal #21913

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 13 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
53 changes: 53 additions & 0 deletions recipes/windows-terminal/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{% set name = "windows-terminal" %}
{% set version = "1.16.1026" %}


package:
name: {{ name|lower }}
version: {{ version }}

source:
- url: https://github.com/microsoft/terminal/releases/download/v{{ version }}1.0/Microsoft.WindowsTerminal_Win10_{{ version }}1.0_8wekyb3d8bbwe.msixbundle
sha256: ba6fc6854e713094b4009cf2021e8b4887cff737ab4b9c4f9390462dd2708298
- url: https://raw.githubusercontent.com/microsoft/terminal/v{{ version }}1.0/LICENSE
sha256: 5d177f23ecfeb0ea8e050b6a5a16355e1ae9a0b286436ca8f83ed08b3795be6b
- url: https://raw.githubusercontent.com/microsoft/terminal/v{{ version }}1.0/NOTICE.md
sha256: 460127a8d31a3083e1673926e1439e001c1662aa36e0b48fa64482dce162b8b1

build:
skip: true # [not win]
number: 0
script: |
7za e .\Microsoft.WindowsTerminal_Win10_{{ version }}1.0_8wekyb3d8bbwe.msixbundle CascadiaPackage_{{ version }}1.0_x64.msix
if %ERRORLEVEL% neq 0 exit 1
7za x -oterminal .\CascadiaPackage_{{ version }}1.0_x64.msix
if %ERRORLEVEL% neq 0 exit 1
xcopy terminal "%PREFIX%\windows-terminal" /E /I /F /B /Y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this creating a windows-terminal directory in the PREFIX root? I think we might want to use a different containing directory, but I am not sure which one is best in Windows.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just PREFIX/Scripts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that scripts/ is mostly used for entry-points, so having wt.cmd in scripts/ makes sense as it's the entry-point for the Windows Terminal application.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it makes sense putting the applications themselves under scripts/, but I'm also not sure there's any conda-forge convention for where to put applications (particularly on
Windows)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we look at what nodejs does, it puts node-modules in the top-level PREFIX, but it also puts the entry-points in PREFIX as well:

❯ ls C:\mambaforge\envs\node

    Directory: C:\mambaforge\envs\node

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----          13/02/2023    21:08                conda-meta
d----          13/02/2023    21:08                node_modules
-a---          05/11/2022    02:26       65491576 node.exe
-a---          05/11/2022    00:48           1365 npm
-a---          05/11/2022    00:48            483 npm.cmd
-a---          05/11/2022    00:48           1567 npx
-a---          05/11/2022    00:48            539 npx.cmd

It's likely that the node.exe binary expects to find the node-modules folder alongside it so that constrains where you could place the executable.

IMHO it would probably be cleaner to put the .cmd files in scripts/, but if the actual binaries are in PREFIX anyway, it probably doesn't have any benefit.

Copy link
Member Author

@dhirschfeld dhirschfeld Feb 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fairly sure that R used to be installed into PREFIX/R but installing the latest version it appears to be installed into PREFIX/lib/R

❯ ls C:\mambaforge\envs\rdev\lib\R

    Directory: C:\mambaforge\envs\rdev\lib\R

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----          13/02/2023    21:11                bin
d----          13/02/2023    21:11                doc
d----          13/02/2023    21:11                etc
d----          13/02/2023    21:11                include
d----          13/02/2023    21:11                library
d----          13/02/2023    21:11                modules
d----          13/02/2023    21:11                share
d----          13/02/2023    21:11                src
d----          13/02/2023    21:11                Tcl
d----          13/02/2023    21:11                tests
-a---          19/12/2022    19:45          27421 CHANGES
-a---          19/12/2022    19:45          18011 COPYING
-a---          19/12/2022    19:45           4132 README
-a---          19/12/2022    19:45           8676 README.R-4.1.3

...with entry-points installed into PREFIX/scripts

❯ ls C:\mambaforge\envs\rdev/Scripts

    Directory: C:\mambaforge\envs\rdev\Scripts

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---          19/12/2022    19:24          22016 open.exe
-a---          19/12/2022    19:24          22016 R.exe
-a---          19/12/2022    19:24          22016 Rcmd.exe
-a---          19/12/2022    19:24          22016 Rfe.exe
-a---          19/12/2022    19:24          22016 Rgui.exe
-a---          19/12/2022    19:24          22016 Rscript.exe
-a---          19/12/2022    19:24          22016 RSetReg.exe
-a---          19/12/2022    19:24          22016 Rterm.exe

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure installing an application under lib makes all that much sense, but it also probably doesn't matter - it's transparent to the user calling R.exe in the PREFIX/Scripts folder.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Windows, the dotnet language installs into PREFIX/dotnet but, since I was the one who made that arbitrary decision, it can't really be used as a precedent here 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the end of the day, I'm happy to install it wherever you think makes most sense.

Following R that would be in PREFIX/lib/windows-terminal but following nodejs that would be in PREFIX/windows-terminal.

I think the status-quo (nodejs convention) makes the most sense, but I also don't really mind and am happy to follow any convention (that doesn't require changes to the application)

if %ERRORLEVEL% neq 0 exit 1
tree /F "%PREFIX%\windows-terminal"
echo F | xcopy %RECIPE_DIR%\wt.cmd %PREFIX%\Scripts\wt.cmd /F /Y
if %ERRORLEVEL% neq 0 exit 1

requirements:
host:
- 7za
run:
- vc
dhirschfeld marked this conversation as resolved.
Show resolved Hide resolved

test:
commands:
- where wt
- if not exist %PREFIX%\\windows-terminal\\wt.exe exit 1

about:
home: https://github.com/microsoft/terminal
summary: 'The new Windows Terminal and the original Windows console host, all in the same place!'
license: MIT
license_family: MIT
license_file:
- LICENSE
- NOTICE.md

extra:
recipe-maintainers:
- dhirschfeld
1 change: 1 addition & 0 deletions recipes/windows-terminal/wt.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@"%~dp0..\windows-terminal\wt.exe" %*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this file be named .cmd or .bat? I think there are behaviour differences (see https://stackoverflow.com/questions/148968/windows-batch-files-bat-vs-cmd), but most scripts in conda-forge are .bat. Reading that link though it looks like .cmd is the modern recommendation? 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we move everything under Scripts we might not need this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I view .bat and .cmd as pretty interchangeable. I've never encountered a situation where it mattered though the SO you linked to is pretty informative! It does seem that .cmd is a bit stricter and generally preferred.

My general adhoc convention is to call scripts .bat and reserve .cmd for files which just set up an environment before calling an external binary.

Since the script doesn't use any of the mentioned commands where there is a difference in errorlevel handling I think it's a moot point. If you'd prefer it be a .bat file I can make that change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we move everything under Scripts we might not need this.

If the application was under scripts/windows-terminal you'd still need a driver script in scripts/ to call it without having to resort to the full pathname of the executable.