Compare commits

..

4 Commits

Author SHA1 Message Date
p53209761 ee8e9b8773 ADD file via upload 2024-06-07 13:56:35 +08:00
p53209761 42da110a8d ADD file via upload 2024-05-30 13:53:20 +08:00
p53209761 2eb2d574a5 Update .git-blame-ignore-revs 2024-05-30 10:08:20 +08:00
p53209761 662c343084 ADD file via upload 2024-05-30 09:45:07 +08:00
6 changed files with 212 additions and 1 deletions

View File

@ -1 +1,3 @@
Make sure to copy your token now as you will not be able to see it again.
Make sure to copy your token now as you will not be able to see it again.
Make sure to copy your token now as you will not be able to see it again.

47
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,47 @@
- id: pyproject-fmt
# https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version
additional_dependencies: ["tox>=4.9"]
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args: ["-rn", "-sn", "--fail-on=I"]
stages: [manual]
- id: rst
name: rst
entry: rst-lint --encoding utf-8
files: ^(RELEASING.rst|README.rst|TIDELIFT.rst)$
language: python
additional_dependencies: [pygments, restructuredtext_lint]
- id: changelogs-rst
name: changelog filenames
language: fail
entry: 'changelog files must be named ####.(breaking|bugfix|deprecation|doc|feature|improvement|trivial|vendor).rst'
exclude: changelog/(\d+\.(breaking|bugfix|deprecation|doc|feature|improvement|trivial|vendor).rst|README.rst|_template.rst)
files: ^changelog/
- id: py-deprecated
name: py library is deprecated
language: pygrep
entry: >
(?x)\bpy\.(
_code\.|
builtin\.|
code\.|
io\.|
path\.local\.sysfind|
process\.|
std\.|
error\.|
xml\.
)
types: [python]
- id: py-path-deprecated
name: py.path usage is deprecated
exclude: docs|src/_pytest/deprecated.py|testing/deprecated_test.py|src/_pytest/legacypath.py
language: pygrep
entry: \bpy\.path\.local
types: [python]

44
OPENCOLLECTIVE.rst Normal file
View File

@ -0,0 +1,44 @@
==============
OpenCollective
==============
pytest has a collective setup at `OpenCollective`_. This document describes how the core team manages
OpenCollective-related activities.
What is it
==========
Open Collective is an online funding platform for open and transparent communities.
It provides tools to raise money and share your finances in full transparency.
It is the platform of choice for individuals and companies that want to make one-time or
monthly donations directly to the project.
Funds
=====
The OpenCollective funds donated to pytest will be used to fund overall maintenance,
local sprints, merchandising (stickers to distribute in conferences for example), and future
gatherings of pytest developers (sprints).
`Core contributors`_ which are contributing on a continuous basis are free to submit invoices
to bill maintenance hours using the platform. How much each contributor should request is still an
open question, but we should use common sense and trust in the contributors, most of which know
themselves in-person. A good rule of thumb is to bill the same amount as monthly payments
contributors which participate in the `Tidelift`_ subscription. If in doubt, just ask.
Admins
======
A few people have admin access to the OpenCollective dashboard to make changes. Those people
are part of the `@pytest-dev/opencollective-admins`_ team.
`Core contributors`_ interested in helping out with OpenCollective maintenance are welcome! We don't
expect much work here other than the occasional approval of expenses from other core contributors.
Just drop a line to one of the `@pytest-dev/opencollective-admins`_ or use the mailing list.
.. _`OpenCollective`: https://opencollective.com/pytest
.. _`Tidelift`: https://tidelift.com
.. _`core contributors`: https://github.com/orgs/pytest-dev/teams/core/members
.. _`@pytest-dev/opencollective-admins`: https://github.com/orgs/pytest-dev/teams/opencollective-admins/members

118
WindowsCrossCompiling.md Normal file
View File

@ -0,0 +1,118 @@
# Building Windows Go programs on Linux
See [here](https://go.dev/doc/install/source#environment) for available `GOOS` and `GOARCH` values.
## Go version >= 1.5
Since Go version 1.5 cross-compiling of pure Go executables has become very easy. Try it out with the code below. More can be found at this blog post by [Dave Cheney][1].
[1]: http://dave.cheney.net/2015/08/22/cross-compilation-with-go-1-5
```go
$ cat hello.go
package main
import "fmt"
func main() {
fmt.Printf("Hello\n")
}
$ GOOS=windows GOARCH=386 go build -o hello.exe hello.go
```
In cmd.exe instead of PowerShell:
```go
$ set GOOS=windows
$ set GOARCH=386
$ go build -o hello.exe hello.go
```
You can now run `hello.exe` on a Windows machine near you.
Note that the command above will silently rebuild most of standard library, and for this reason will be quite slow. To speed-up the process, you can install all the windows-amd64 standard packages on your system with
```
GOOS=windows GOARCH=amd64 go install
```
Note also that `cgo` is disabled when cross-compiling, so any file that mentions `import "C"` will be silently ignored (See https://github.com/golang/go/issues/24068). In order to use cgo, or any of the build modes `c-archive`, `c-shared`, `shared`, `plugin`, you need to have a C cross-compiler.
## Older Go version (<1.5)
I use linux/386, but, I suspect, this procedure will apply to other host platforms as well.
Preparation (if needed):
```sh
sudo apt-get install gcc
export go env GOROOT
```
First step is to build host version of go:
```sh
cd $GOROOT/src
sudo -E GOOS=windows GOARCH=386 PATH=$PATH ./make.bash
```
Next you need to build the rest of go compilers and linkers. I have small program to do that:
```sh
$ cat ~/bin/buildcmd
#!/bin/sh
set -e
for arch in 8 6; do
for cmd in a c g l; do
go tool dist install -v cmd/$arch$cmd
done
done
exit 0
```
Last step is to build Windows versions of standard commands and libraries. I have a small script for that too:
```sh
$ cat ~/bin/buildpkg
#!/bin/sh
if [ -z "$1" ]; then
echo 'GOOS is not specified' 1>&2
exit 2
else
export GOOS=$1
if [ "$GOOS" = "windows" ]; then
export CGO_ENABLED=0
fi
fi
shift
if [ -n "$1" ]; then
export GOARCH=$1
fi
cd $GOROOT/src
go tool dist install -v pkg/runtime
go install -v -a std
```
I run it like that:
```sh
$ ~/bin/buildpkg windows 386
```
to build Windows/386 version of Go commands and packages. You can probably see from my script that I exclude building of any cgo related parts &mdash; these will not work for me, since I do not have correspondent gcc cross-compiling tools installed. So I just skip those.
Now we're ready to build our Windows executable:
```go
$ cat hello.go
package main
import "fmt"
func main() {
fmt.Printf("Hello\n")
}
$ GOOS=windows GOARCH=386 go build -o hello.exe hello.go
```
We just need to find a Windows computer to run our `hello.exe`.

BIN
csdn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

BIN
docker.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB