manygo 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
manygo/__init__.py ADDED
@@ -0,0 +1,65 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Literal
4
+
5
+ # Supported Go operating systems with known platform tags
6
+ GOOS = Literal['darwin', 'linux', 'windows']
7
+
8
+ # Supported Go architectures with known platform tags
9
+ GOARCH = Literal['amd64', 'arm64', '386', 'arm', 's390x', 'ppc64le', 'ppc64']
10
+
11
+ def get_platform_tag(
12
+ goos: GOOS,
13
+ goarch: GOARCH
14
+ ) -> str:
15
+ """
16
+ Convert GOOS and GOARCH to a valid Python platform tag.
17
+
18
+ This function provides a mapping between Go's platform identifiers
19
+ (operating system and architecture) and Python platform tags used
20
+ in packaging and distribution.
21
+
22
+ Supported platforms are derived from the Go toolchain's supported
23
+ platforms, which can be listed via `$ go tools dist list`. See also,
24
+ https://go.dev/doc/install/source#environment. Python's platform tags
25
+ are described in https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/#platform-tag.
26
+
27
+ Args:
28
+ goos (GOOS): The operating system identifier
29
+ goarch (GOARCH): The architecture identifier
30
+
31
+ Returns:
32
+ str: A Python platform tag suitable for wheel or other packaging
33
+
34
+ Raises:
35
+ ValueError: If no platform tag can be generated for the given combination
36
+ """
37
+ # Mapping of special cases and conversions
38
+ platform_map = {
39
+ ('darwin', 'amd64'): 'macosx_10_12_x86_64',
40
+ ('darwin', 'arm64'): 'macosx_11_0_arm64',
41
+ ('windows', '386'): 'win32',
42
+ ('windows', 'arm64'): 'win_arm64',
43
+ ('windows', 'amd64'): 'win_amd64',
44
+ }
45
+
46
+ # Check for direct mapping first
47
+ if (goos, goarch) in platform_map:
48
+ return platform_map[(goos, goarch)]
49
+
50
+ # Generic fallback conversion
51
+ arch_map = {
52
+ 'amd64': 'x86_64',
53
+ 'arm64': 'aarch64',
54
+ '386': 'i686',
55
+ 'arm': 'armv7l',
56
+ 's390x': 's390x',
57
+ 'ppc64le': 'ppc64le',
58
+ 'ppc64': 'ppc64',
59
+ }
60
+
61
+ # Try to construct a generic tag
62
+ if goos == 'linux' and goarch in arch_map:
63
+ return f'manylinux_2_17_{arch_map[goarch]}'
64
+
65
+ raise ValueError(f'No platform tag for {goos}/{goarch}')
@@ -0,0 +1,50 @@
1
+ Metadata-Version: 2.4
2
+ Name: manygo
3
+ Version: 0.1.0
4
+ Summary: Python library with helpers for packaging golang source code
5
+ Author-email: Jamison Lahman <jamison@lahman.dev>
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Keywords: golang,packaging,platform-tags
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+
21
+ # manygo
22
+
23
+ A Python library for generating platform-specific tags for Golang packages and binaries.
24
+
25
+ ## Overview
26
+
27
+ `manygo` provides utilities to help with packaging and distributing Golang applications, with a focus on generating accurate Python platform tags for cross-platform compatibility.
28
+
29
+ ## Features
30
+
31
+ - Convert Golang platform identifiers (GOOS and GOARCH) to Python platform tags
32
+ - Support for multiple architectures and operating systems
33
+ - Helpful for creating wheel distributions and managing platform-specific builds
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ pip install manygo
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ ```python
44
+ >>> import manygo
45
+ >>> manygo.get_platform_tag('linux', 'amd64')
46
+ 'manylinux_2_17_x86_64'
47
+
48
+ >>> manygo.get_platform_tag('darwin', 'arm64')
49
+ 'macosx_11_0_arm64'
50
+ ```
@@ -0,0 +1,5 @@
1
+ manygo/__init__.py,sha256=H2cIeMcfobKNiKC5qubj8vg0SiQc0ONA1F9GgbVx_hU,2118
2
+ manygo-0.1.0.dist-info/METADATA,sha256=yyGtpJJRhGZ4aoy8D48j-FZ0TnQz3g9veMUqJiTcmbc,1519
3
+ manygo-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
4
+ manygo-0.1.0.dist-info/licenses/LICENSE,sha256=P_te03YIieIzk4EnP3-blVrdJGbhityi_YcHwxaL7gk,1071
5
+ manygo-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Jamison Lahman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.