[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-12-12 Thread Owen Pan via cfe-commits

owenca wrote:

See #75268.

https://github.com/llvm/llvm-project/pull/69228
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-12-12 Thread Owen Pan via cfe-commits


@@ -0,0 +1 @@
+py -3 git-clang-format %*

owenca wrote:

@llvm-beanz This doesn't seem to work if `git-clang-format` is run from another 
directory:
```
C:\Users\Owen\llvm-project>clang\tools\clang-format\git-clang-format

C:\Users\Owen\llvm-project>py -3 git-clang-format
C:\Users\Owen\AppData\Local\Programs\Python\Python39\python.exe: can't open 
file 'C:\Users\Owen\llvm-project\git-clang-format': [Errno 2] No such file or 
directory

C:\Users\Owen\llvm-project>
```

https://github.com/llvm/llvm-project/pull/69228
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-10-21 Thread Chris B via cfe-commits

https://github.com/llvm-beanz closed 
https://github.com/llvm/llvm-project/pull/69228
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-10-20 Thread Owen Pan via cfe-commits

https://github.com/owenca approved this pull request.


https://github.com/llvm/llvm-project/pull/69228
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-10-20 Thread Chris B via cfe-commits


@@ -0,0 +1 @@
+py -3 git-clang-format %*

llvm-beanz wrote:

`py.exe` is the Windows python launcher. It comes with Python for Windows (not 
msys2 or cygwin where the shebang line would work). It is the Windows way of 
choosing which python version you want. You need to use this approach because 
the standard Python for Windows install always installs `python.exe` regardless 
of version because Windows generally doesn't version binaries.

[1] [Python for Windows 
docs](https://docs.python.org/3/using/windows.html#launcher)
[2] [Microsoft 
docs](https://learn.microsoft.com/en-us/windows/python/faqs#what-is-py-exe-)

I'm going to go take a long shower now to try and forget that I learned this 
much about Windows.

https://github.com/llvm/llvm-project/pull/69228
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-10-20 Thread Björn Schäpers via cfe-commits

HazardyKnusperkeks wrote:

I have no real opinion on this matter, as I don't use that program/script. But 
when it helps the windows users, why not? I also see no harm.

https://github.com/llvm/llvm-project/pull/69228
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-10-20 Thread Björn Schäpers via cfe-commits


@@ -0,0 +1 @@
+py -3 git-clang-format %*

HazardyKnusperkeks wrote:

What is `py`? I have no program called `py` on my machine (Windows with msys2), 
so you would possibly break that? Why not write `python` or `python3`?

https://github.com/llvm/llvm-project/pull/69228
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-10-19 Thread Owen Pan via cfe-commits

owenca wrote:

@mydeveloperday what do you think?

https://github.com/llvm/llvm-project/pull/69228
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-10-19 Thread Chris B via cfe-commits

llvm-beanz wrote:

> Can you open an issue and link to it from here?

Filed #69643.

> It seems `git clang-format` works in Command Prompt without this new batch 
> file.

IIUC, `git clang-format` works if you have WSL installed, but not with a 
default Windows installation. We definitely have users on my team that are 
Windows-only users who encounter an error running that command even if the 
git-clang-format script is on the path, and the presence of the `.bat` file 
solves the issue.

https://github.com/llvm/llvm-project/pull/69228
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-10-19 Thread Chris B via cfe-commits

https://github.com/llvm-beanz edited 
https://github.com/llvm/llvm-project/pull/69228
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-10-16 Thread Owen Pan via cfe-commits

owenca wrote:

> This allows git-clang-format to be used on a Windows terminal without 
> manually needing to find the path and invoke the python interpreter. We have 
> a similar script for `scan-build`.

Can you open an issue and link to it from here? It seems `git clang-format` 
works in Command Prompt without this new batch file.

https://github.com/llvm/llvm-project/pull/69228
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-10-16 Thread Damyan Pepper via cfe-commits

https://github.com/damyanp approved this pull request.


https://github.com/llvm/llvm-project/pull/69228
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-10-16 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-format

Author: Chris B (llvm-beanz)


Changes

This allows git-clang-format to be used on a Windows terminal without manually 
needing to find the path and invoke the python interpreter. We have a similar 
script for `scan-build`.

---
Full diff: https://github.com/llvm/llvm-project/pull/69228.diff


2 Files Affected:

- (modified) clang/tools/clang-format/CMakeLists.txt (+6) 
- (added) clang/tools/clang-format/git-clang-format.bat (+1) 


``diff
diff --git a/clang/tools/clang-format/CMakeLists.txt 
b/clang/tools/clang-format/CMakeLists.txt
index 30c93f8667c8359..1c61a3c8fb80368 100644
--- a/clang/tools/clang-format/CMakeLists.txt
+++ b/clang/tools/clang-format/CMakeLists.txt
@@ -38,3 +38,9 @@ install(FILES clang-format.py
 install(PROGRAMS git-clang-format
   DESTINATION "${CMAKE_INSTALL_BINDIR}"
   COMPONENT clang-format)
+
+if (WIN32 AND NOT CYGWIN)
+  install(PROGRAMS git-clang-format.bat
+DESTINATION "${CMAKE_INSTALL_BINDIR}"
+COMPONENT clang-format)
+endif()
diff --git a/clang/tools/clang-format/git-clang-format.bat 
b/clang/tools/clang-format/git-clang-format.bat
new file mode 100644
index 000..d4bc5172989cb09
--- /dev/null
+++ b/clang/tools/clang-format/git-clang-format.bat
@@ -0,0 +1 @@
+py -3 git-clang-format %*

``




https://github.com/llvm/llvm-project/pull/69228
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

2023-10-16 Thread Chris B via cfe-commits

https://github.com/llvm-beanz created 
https://github.com/llvm/llvm-project/pull/69228

This allows git-clang-format to be used on a Windows terminal without manually 
needing to find the path and invoke the python interpreter. We have a similar 
script for `scan-build`.

>From 8d56f363230ff064fc3fba7d75c6713af8d64f66 Mon Sep 17 00:00:00 2001
From: Chris Bieneman 
Date: Mon, 16 Oct 2023 11:30:21 -0500
Subject: [PATCH] [Windows] Add git-clang-format wrapper bat file

This allows git-clang-format to be used on a Windows terminal without
manually needing to find the path and invoke the python interpreter. We
have a similar script for `scan-build`.
---
 clang/tools/clang-format/CMakeLists.txt   | 6 ++
 clang/tools/clang-format/git-clang-format.bat | 1 +
 2 files changed, 7 insertions(+)
 create mode 100644 clang/tools/clang-format/git-clang-format.bat

diff --git a/clang/tools/clang-format/CMakeLists.txt 
b/clang/tools/clang-format/CMakeLists.txt
index 30c93f8667c8359..1c61a3c8fb80368 100644
--- a/clang/tools/clang-format/CMakeLists.txt
+++ b/clang/tools/clang-format/CMakeLists.txt
@@ -38,3 +38,9 @@ install(FILES clang-format.py
 install(PROGRAMS git-clang-format
   DESTINATION "${CMAKE_INSTALL_BINDIR}"
   COMPONENT clang-format)
+
+if (WIN32 AND NOT CYGWIN)
+  install(PROGRAMS git-clang-format.bat
+DESTINATION "${CMAKE_INSTALL_BINDIR}"
+COMPONENT clang-format)
+endif()
diff --git a/clang/tools/clang-format/git-clang-format.bat 
b/clang/tools/clang-format/git-clang-format.bat
new file mode 100644
index 000..d4bc5172989cb09
--- /dev/null
+++ b/clang/tools/clang-format/git-clang-format.bat
@@ -0,0 +1 @@
+py -3 git-clang-format %*

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits