Skip to content

Commit 1c874cf

Browse files
committed
Initial commit
0 parents  commit 1c874cf

7 files changed

Lines changed: 179 additions & 0 deletions

File tree

.github/workflows/CI.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
on: [push, pull_request]
2+
3+
name: CI
4+
5+
jobs:
6+
check:
7+
name: Check
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: actions-rs/toolchain@v1
12+
with:
13+
profile: minimal
14+
toolchain: stable
15+
override: true
16+
- uses: actions-rs/cargo@v1
17+
with:
18+
command: check
19+
20+
test:
21+
name: Test Suite
22+
runs-on: ${{ matrix.os }}
23+
strategy:
24+
matrix:
25+
os: [ubuntu-latest, macos-latest, windows-latest]
26+
steps:
27+
- uses: actions/checkout@v2
28+
- uses: actions-rs/toolchain@v1
29+
with:
30+
profile: minimal
31+
toolchain: stable
32+
override: true
33+
- uses: actions-rs/cargo@v1
34+
with:
35+
command: test
36+
37+
fmt:
38+
name: Rustfmt
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v2
42+
- uses: actions-rs/toolchain@v1
43+
with:
44+
profile: minimal
45+
toolchain: stable
46+
override: true
47+
- run: rustup component add rustfmt
48+
- uses: actions-rs/cargo@v1
49+
with:
50+
command: fmt
51+
args: --all -- --check

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/target
2+
Cargo.lock

Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[package]
2+
name = "python-pkginfo"
3+
version = "0.1.0"
4+
authors = ["messense <messense@icloud.com>"]
5+
edition = "2018"
6+
description = "Query Python package metadata from sdist and bdists and etc."
7+
keywords = ["python", "pkginfo", "metadata"]
8+
license = "MIT"
9+
readme = "README.md"
10+
repository = "https://github.com/messense/python-pkginfo-rs"
11+
12+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
13+
14+
[dependencies]
15+
mailparse = "0.13.4"
16+
zip = "0.5.12"

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2021 Messense Lv
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9+
of the Software, and to permit persons to whom the Software is furnished to do
10+
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.

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# python-pkginfo-rs
2+
3+
[![GitHub Actions](https://github.com/messense/python-pkginfo-rs/workflows/CI/badge.svg)](https://github.com/messense/python-pkginfo-rs/actions?query=workflow%3ACI)
4+
[![Crates.io](https://img.shields.io/crates/v/python-pkginfo.svg)](https://crates.io/crates/python-pkginfo)
5+
[![docs.rs](https://docs.rs/python-pkginfo/badge.svg)](https://docs.rs/python-pkginfo/)
6+
7+
Query Python package metadata from sdist and bdists and etc.
8+
9+
## Installation
10+
11+
Add it to your ``Cargo.toml``:
12+
13+
```toml
14+
[dependencies]
15+
python-pkginfo = "0.1"
16+
```
17+
18+
then you are good to go. If you are using Rust 2015 you have to add ``extern crate python_pkginfo`` to your crate root as well.
19+
20+
## License
21+
22+
This work is released under the MIT license. A copy of the license is provided in the [LICENSE](./LICENSE) file.

src/distribution.rs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#[derive(Debug, Clone, Default, PartialEq)]
2+
pub struct Distribution {
3+
/// Version of the file format; legal values are “1.0”, “1.1”, “1.2”, “2.1” and “2.2”.
4+
pub metadata_version: String,
5+
/// The name of the distribution.
6+
pub name: String,
7+
/// A string containing the distribution’s version number.
8+
pub version: String,
9+
/// A Platform specification describing an operating system supported by the distribution
10+
/// which is not listed in the “Operating System” Trove classifiers.
11+
pub platforms: Vec<String>,
12+
/// Binary distributions containing a PKG-INFO file will use the Supported-Platform field
13+
/// in their metadata to specify the OS and CPU for which the binary distribution was compiled.
14+
pub supported_platforms: Vec<String>,
15+
/// A one-line summary of what the distribution does.
16+
pub summary: Option<String>,
17+
/// A longer description of the distribution that can run to several paragraphs.
18+
pub description: Option<String>,
19+
/// A list of additional keywords, separated by commas, to be used to
20+
/// assist searching for the distribution in a larger catalog.
21+
pub keywords: Vec<String>,
22+
/// A string containing the URL for the distribution’s home page.
23+
pub home_page: Option<String>,
24+
/// A string containing the URL from which this version of the distribution can be downloaded.
25+
pub download_url: Option<String>,
26+
/// A string containing the author’s name at a minimum; additional contact information may be provided.
27+
pub author: Option<String>,
28+
/// A string containing the author’s e-mail address. It can contain a name and e-mail address in the legal forms for a RFC-822 `From:` header.
29+
pub author_email: Option<String>,
30+
/// Text indicating the license covering the distribution where the license is not a selection from the “License” Trove classifiers.
31+
pub license: Option<String>,
32+
/// Each entry is a string giving a single classification value for the distribution.
33+
pub classifiers: Vec<String>,
34+
/// Each entry contains a string naming some other distutils project required by this distribution.
35+
pub requires_dist: Vec<String>,
36+
/// Each entry contains a string naming a Distutils project which is contained within this distribution.
37+
pub provides_dist: Vec<String>,
38+
/// Each entry contains a string describing a distutils project’s distribution which this distribution renders obsolete,
39+
/// meaning that the two projects should not be installed at the same time.
40+
pub obsoletes_dist: Vec<String>,
41+
/// A string containing the maintainer’s name at a minimum; additional contact information may be provided.
42+
///
43+
/// Note that this field is intended for use when a project is being maintained by someone other than the original author:
44+
/// it should be omitted if it is identical to `author`.
45+
pub maintainer: Option<String>,
46+
/// A string containing the maintainer’s e-mail address.
47+
/// It can contain a name and e-mail address in the legal forms for a RFC-822 `From:` header.
48+
///
49+
/// Note that this field is intended for use when a project is being maintained by someone other than the original author:
50+
/// it should be omitted if it is identical to `author_email`.
51+
pub maintainer_email: Option<String>,
52+
/// This field specifies the Python version(s) that the distribution is guaranteed to be compatible with.
53+
pub requires_python: Option<String>,
54+
/// Each entry contains a string describing some dependency in the system that the distribution is to be used.
55+
pub requires_external: Vec<String>,
56+
/// A string containing a browsable URL for the project and a label for it, separated by a comma.
57+
pub project_urls: Vec<String>,
58+
/// A string containing the name of an optional feature. Must be a valid Python identifier.
59+
/// May be used to make a dependency conditional on whether the optional feature has been requested.
60+
pub provides_extras: Vec<String>,
61+
/// A string stating the markup syntax (if any) used in the distribution’s description,
62+
/// so that tools can intelligently render the description.
63+
pub description_content_type: Option<String>,
64+
}

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mod distribution;
2+
3+
pub use crate::distribution::Distribution;

0 commit comments

Comments
 (0)