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

Update docs contribution guide to include M1 details. #1177

Merged
merged 3 commits into from
Apr 12, 2023

Conversation

freakboy3742
Copy link
Member

When running on an M1 Mac, there's a couple of extra steps needed to lint documentation.

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct


.. group-tab:: 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.

@rmartin16 Don't suppose you can fill in the gaps here? What's the Windows equivalent of $()?

Copy link
Contributor

@proneon267 proneon267 Apr 11, 2023

Choose a reason for hiding this comment

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

Hello
The Windows equivalent is %(). For example, if you wanted to set a variable equal to the output of a command in Windows, you could do: set var=%(command%)

But I think what you are after is:
for /f "usebackq delims=" %i in (`python -m certifi`) do set SSL_CERT_FILE=%i
Also, maybe you can use %%i instead of %i

Copy link
Member

@rmartin16 rmartin16 Apr 11, 2023

Choose a reason for hiding this comment

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

Indeed....cmd uses a FOR loop... to capture command output... 🤷🏼

But usebackq is unnecessary....delims will help avoid breaking the path, though.

FOR /f "delims=" %i IN ('python -m certifi') DO SET SSL_CERT_FILE=%i

That said....this may be a good time to decide if we want to continue providing cmd and powershell commands....or only provide commands compatible with powershell (and subsequently msft's Terminal). According to msft, all windows ship PowerShell now.

This is the PowerShell command:

$env:SSL_CERT_FILE=$(python -m certifi)

Note that neither of these commands can run in the other environment.

CC: @mhsmith incase you have input on providing commands for Windows in docs

Copy link
Member

Choose a reason for hiding this comment

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

oh yeah, also....enchant doesn't work with Windows Store Python 🙃

docs-lint: commands[1] C:\Users\user\github\beeware\briefcase\docs> python -m sphinx -W --keep-going -j auto -n -v -E -T -a -d C:\Users\user\github\beeware\briefcase\.tox\docs-lint\tmp/doctrees -b spelling . _build/spell
Running Sphinx v6.1.3

** (python3.10.exe:6932): WARNING **: 08:36:07.767: Error loading plugin: 'C:\Users\user\github\beeware\briefcase\.tox\docs-lint\lib\site-packages\enchant\data\mingw64/lib/enchant-2\enchant_hunspell.dll': The specified module could not be found.
❯ ls C:\Users\user\github\beeware\briefcase\.tox\docs-lint\lib\site-packages\enchant\data\mingw64/lib/enchant-2\enchant_hunspell.dll


    Directory: C:\Users\user\github\beeware\briefcase\.tox\docs-lint\lib\site-packages\enchant\data\mingw64\lib\enchant-2


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         4/11/2023   8:35 AM         632014 enchant_hunspell.dll

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like there's a bunch of installation options for penchant... I think I'll just defer to the official docs.

But: Is pyenchant our only option? AFAICT, the only platform where it seems to work well is Linux...

Copy link
Member

Choose a reason for hiding this comment

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

and just so its clear....that FOR statement won't run in powershell

Copy link
Member Author

Choose a reason for hiding this comment

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

Understood. I guess I don't have a good feel for what Windows users consider the "default" shell - or how to signal to Windows users (who are, historically, our users with the least exposure to the command line) that the command is a Powershell command, not a cmd.exe command.

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 also somewhat hesitant because I thought I'd try out a "beeware tutorial" scenario with Powershell... and the first thing I got was an impenetrable permission error about my execution policy not having permissions to run scripts. I, for one, would rather not put myself in a situation of trying to teach someone who is sending screenshots of terminal sessions how to turn on scripting permissions...

Copy link
Member

Choose a reason for hiding this comment

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

I'm not advocating for PowerShell per se; it introduces its own difficulties. It seems that msft is transitioning to a default experience not based on cmd.exe; for instance, they removed it from the Start Menu a while ago. But their approach doesn't seem that heavy-handed, though ( especially when you compare it to how hard they push Edge); so, Windows won't ask me "are you sure you don't want PowerShell even though you typed cmd in the search".

Mostly, I'm just interested in making sure we can provide some level of consistency for documenting commands for Windows. For instance, the Android code-signing page contains commands for both cmd and PowerShell.

Copy link
Member

Choose a reason for hiding this comment

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

I know this isn't your point but for completeness...

Open PowerShell with Administrative privileges and run:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

and restart your terminal sessions.

@rmartin16
Copy link
Member

while we're on the topic of windows....tox -e docs-lint believes iOS is spelled wrong on windows

@freakboy3742 freakboy3742 merged commit 5e1600b into beeware:main Apr 12, 2023
@freakboy3742 freakboy3742 deleted the m1-docs branch April 12, 2023 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants