diff options
author | Jeff Vander Stoep <jeffv@google.com> | 2023-02-02 15:17:56 +0100 |
---|---|---|
committer | Jeff Vander Stoep <jeffv@google.com> | 2023-02-02 15:17:56 +0100 |
commit | 424ec153962f3376137f3801ad3a0e93614ddb97 (patch) | |
tree | ebe71c26fe83651640f46b9944cfdf666a153241 | |
parent | 6b428596616f0903f36fedefc2eff2431ebdb8ed (diff) | |
download | glob-424ec153962f3376137f3801ad3a0e93614ddb97.tar.gz |
Upgrade glob to 0.3.1
This project was upgraded with external_updater.
Usage: tools/external_updater/updater.sh update rust/crates/glob
For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
Test: TreeHugger
Change-Id: I05deb0a04e6b1d80c020b9fc37856d4c2fd6188e
-rw-r--r-- | .cargo_vcs_info.json | 7 | ||||
-rw-r--r-- | .github/workflows/rust.yml | 35 | ||||
-rw-r--r-- | .travis.yml | 24 | ||||
-rw-r--r-- | Android.bp | 3 | ||||
-rw-r--r-- | Cargo.toml | 24 | ||||
-rw-r--r-- | Cargo.toml.orig | 7 | ||||
-rw-r--r-- | METADATA | 14 | ||||
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | src/lib.rs | 39 | ||||
-rw-r--r-- | triagebot.toml | 1 |
10 files changed, 103 insertions, 57 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 5a44d36..ddc0af5 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,5 +1,6 @@ { "git": { - "sha1": "b003dc3218b006f4e9eb7cff6e63e9087706615e" - } -} + "sha1": "408e579f74830c2073180a7e4e214a2677d38a49" + }, + "path_in_vcs": "" +}
\ No newline at end of file diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..f132f8b --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,35 @@ +name: Continuous integration + +on: + pull_request: + push: + branches: + - master + +jobs: + os_tests: + name: "Tests / OS: ${{ matrix.os }} - ${{ matrix.channel }}" + runs-on: ${{ matrix.os }} + strategy: + matrix: + channel: + - stable + - beta + - nightly + - 1.23.0 + os: + # FIXME: compiling with 1.23 on macOS 12 fails to linL + # archive member 'rust.metadata.bin' with length 40821 is not mach-o or llvm bitcode file + - macos-11 + - windows-2022 + - ubuntu-22.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Update rust + run: rustup update ${{ matrix.channel }} --no-self-update + + - name: Tests + run: cargo +${{ matrix.channel }} test --all diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index cebc669..0000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: rust -rust: - - 1.23.0 - - stable - - beta - - nightly -sudo: false -before_script: - - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH -script: - - cargo build --verbose - - cargo test --verbose - - cargo doc --no-deps -after_success: - - travis-cargo --only nightly doc-upload -env: - global: - secure: "AabAhHaQBO8LF3D1c9xFTpeLW2MH09719QUd99O24jqyTc02dzxZ2faLGupAwE+EBfjb6YWuWugvWDmcxGOzWs3QeYH+t/j319IeXeiULBc6wuNTMh4rHOZ5F9IQx+RPYDltIMIZTPsbRjF/yaGdUDIRy38FD4hDGmBWSYdubSo=" - - - -notifications: - email: - on_success: never @@ -39,11 +39,10 @@ license { rust_library { name: "libglob", - // has rustc warnings host_supported: true, crate_name: "glob", cargo_env_compat: true, - cargo_pkg_version: "0.3.0", + cargo_pkg_version: "0.3.1", srcs: ["src/lib.rs"], edition: "2015", apex_available: [ @@ -3,22 +3,28 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies +# to registry (e.g., crates.io) dependencies. # -# If you believe there's an error in this file please file an -# issue against the rust-lang/cargo repository. If you're -# editing this file be aware that the upstream Cargo.toml -# will likely look very different (and much more reasonable) +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. [package] name = "glob" -version = "0.3.0" +version = "0.3.1" authors = ["The Rust Project Developers"] -description = "Support for matching file paths against Unix shell style patterns.\n" +description = """ +Support for matching file paths against Unix shell style patterns. +""" homepage = "https://github.com/rust-lang/glob" -documentation = "https://docs.rs/glob/0.3.0" +documentation = "https://docs.rs/glob/0.3.1" +readme = "README.md" categories = ["filesystem"] -license = "MIT/Apache-2.0" +license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/glob" + +[dev-dependencies.doc-comment] +version = "0.3" + [dev-dependencies.tempdir] version = "0.3" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 05f59bc..ca7cdad 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,12 +1,12 @@ [package] name = "glob" -version = "0.3.0" +version = "0.3.1" authors = ["The Rust Project Developers"] -license = "MIT/Apache-2.0" +license = "MIT OR Apache-2.0" homepage = "https://github.com/rust-lang/glob" repository = "https://github.com/rust-lang/glob" -documentation = "https://docs.rs/glob/0.3.0" +documentation = "https://docs.rs/glob/0.3.1" description = """ Support for matching file paths against Unix shell style patterns. """ @@ -14,3 +14,4 @@ categories = ["filesystem"] [dev-dependencies] tempdir = "0.3" +doc-comment = "0.3" @@ -1,3 +1,7 @@ +# This project was upgraded with external_updater. +# Usage: tools/external_updater/updater.sh update rust/crates/glob +# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md + name: "glob" description: "Support for matching file paths against Unix shell style patterns." third_party { @@ -7,13 +11,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/glob/glob-0.3.0.crate" + value: "https://static.crates.io/crates/glob/glob-0.3.1.crate" } - version: "0.3.0" + version: "0.3.1" license_type: NOTICE last_upgrade_date { - year: 2020 - month: 3 - day: 31 + year: 2023 + month: 2 + day: 2 } } @@ -3,9 +3,9 @@ glob Support for matching file paths against Unix shell style patterns. -[![Build Status](https://travis-ci.org/rust-lang-nursery/glob.svg?branch=master)](https://travis-ci.org/rust-lang-nursery/glob) +[![Continuous integration](https://github.com/rust-lang/glob/actions/workflows/rust.yml/badge.svg)](https://github.com/rust-lang/glob/actions/workflows/rust.yml) -[Documentation](https://doc.rust-lang.org/glob) +[Documentation](https://docs.rs/glob) ## Usage @@ -13,7 +13,7 @@ To use `glob`, add this to your `Cargo.toml`: ```toml [dependencies] -glob = "0.3.0" +glob = "0.3.1" ``` And add this to your crate root: @@ -58,10 +58,16 @@ #![doc( html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://www.rust-lang.org/favicon.ico", - html_root_url = "https://docs.rs/glob/0.3.0" + html_root_url = "https://docs.rs/glob/0.3.1" )] #![deny(missing_docs)] -#![cfg_attr(all(test, windows), feature(std_misc))] + +#[cfg(test)] +#[macro_use] +extern crate doc_comment; + +#[cfg(test)] +doctest!("../README.md"); use std::cmp; use std::error::Error; @@ -85,6 +91,7 @@ use PatternToken::{AnyChar, AnyRecursiveSequence, AnySequence, AnyWithin, Char}; /// `GlobError` is returned to express this. /// /// See the `glob` function for more details. +#[derive(Debug)] pub struct Paths { dir_patterns: Vec<Pattern>, require_dir: bool, @@ -170,7 +177,6 @@ pub fn glob(pattern: &str) -> Result<Paths, PatternError> { pub fn glob_with(pattern: &str, options: MatchOptions) -> Result<Paths, PatternError> { #[cfg(windows)] fn check_windows_verbatim(p: &Path) -> bool { - use std::path::Prefix; match p.components().next() { Some(Component::Prefix(ref p)) => p.kind().is_verbatim(), _ => false, @@ -287,10 +293,12 @@ impl GlobError { } impl Error for GlobError { + #[allow(deprecated)] fn description(&self) -> &str { self.error.description() } + #[allow(unknown_lints, bare_trait_objects)] fn cause(&self) -> Option<&Error> { Some(&self.error) } @@ -588,11 +596,12 @@ impl Pattern { }); }; - let tokens_len = tokens.len(); - if is_valid { // collapse consecutive AnyRecursiveSequence to a // single one + + let tokens_len = tokens.len(); + if !(tokens_len > 1 && tokens[tokens_len - 1] == AnyRecursiveSequence) { is_recursive = true; tokens.push(AnyRecursiveSequence); @@ -961,7 +970,7 @@ fn chars_eq(a: char, b: char, case_sensitive: bool) -> bool { /// Configuration options to modify the behaviour of `Pattern::matches_with(..)`. #[allow(missing_copy_implementations)] -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] pub struct MatchOptions { /// Whether or not patterns should be matched in a case-sensitive manner. /// This currently only considers upper/lower case relationships between @@ -996,6 +1005,11 @@ impl MatchOptions { /// require_literal_leading_dot: false /// } /// ``` + /// + /// # Note + /// The behavior of this method doesn't match `default()`'s. This returns + /// `case_sensitive` as `true` while `default()` does it as `false`. + // FIXME: Consider unity the behavior with `default()` in a next major release. pub fn new() -> Self { Self { case_sensitive: true, @@ -1078,12 +1092,21 @@ mod test { #[cfg(windows)] fn win() { use std::env::current_dir; - use std::ffi::AsOsStr; + use std::path::Component; // check windows absolute paths with host/device components let root_with_device = current_dir() .ok() - .and_then(|p| p.prefix().map(|p| p.join("*"))) + .and_then(|p| { + match p.components().next().unwrap() { + Component::Prefix(prefix_component) => { + let path = Path::new(prefix_component.as_os_str()); + path.join("*"); + Some(path.to_path_buf()) + } + _ => panic!("no prefix in this path"), + } + }) .unwrap(); // FIXME (#9639): This needs to handle non-utf8 paths assert!(glob(root_with_device.as_os_str().to_str().unwrap()) diff --git a/triagebot.toml b/triagebot.toml new file mode 100644 index 0000000..fa0824a --- /dev/null +++ b/triagebot.toml @@ -0,0 +1 @@ +[assign] |