Fix env::home_dir deprecation

epel9
Josh Stone 7 years ago
parent 94a6e9d667
commit 98111ba22f

@ -0,0 +1,60 @@
From 84cfdb51775b327fedf21784749d862fdffa10b4 Mon Sep 17 00:00:00 2001
From: Steven Allen <steven@stebalien.com>
Date: Fri, 27 Jul 2018 16:30:29 -0700
Subject: [PATCH] fix warning due to use of env::home_dir
---
src/lib.rs | 10 +++++++---
src/terminfo/searcher.rs | 4 +++-
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/lib.rs b/src/lib.rs
index d8c1e7a64210..f28699d77d52 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -56,13 +56,17 @@
//! [win]: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682010%28v=vs.85%29.aspx
//! [ti]: https://en.wikipedia.org/wiki/Terminfo
-#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
- html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
- html_root_url = "https://stebalien.github.io/doc/term/term/", test(attr(deny(warnings))))]
+#![doc(
+ html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+ html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
+ html_root_url = "https://stebalien.github.io/doc/term/term/",
+ test(attr(deny(warnings)))
+)]
#![deny(missing_docs)]
#![cfg_attr(test, deny(warnings))]
extern crate byteorder;
+extern crate dirs;
use std::io::prelude::*;
diff --git a/src/terminfo/searcher.rs b/src/terminfo/searcher.rs
index 76865748db6d..27eabaa38648 100644
--- a/src/terminfo/searcher.rs
+++ b/src/terminfo/searcher.rs
@@ -16,6 +16,8 @@ use std::env;
use std::fs;
use std::path::PathBuf;
+use dirs;
+
/// Return path to database entry for `term`
pub fn get_dbpath_for_term(term: &str) -> Option<PathBuf> {
let mut dirs_to_search = Vec::new();
@@ -56,7 +58,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<PathBuf> {
// ~/.terminfo, ncurses will search /etc/terminfo, then
// /lib/terminfo, and eventually /usr/share/terminfo.
// On Haiku the database can be found at /boot/system/data/terminfo
- if let Some(mut homedir) = env::home_dir() {
+ if let Some(mut homedir) = dirs::home_dir() {
homedir.push(".terminfo");
dirs_to_search.push(homedir)
}
--
2.17.1

@ -6,7 +6,7 @@
Name: rust-%{crate}
Version: 0.5.1
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Terminal formatting library
License: MIT or ASL 2.0
@ -14,13 +14,18 @@ URL: https://crates.io/crates/term
Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate
# Initial patched metadata
# * No windows
Patch0: term-0.5.1-fix-metadata.diff
# * add dirs dependency
Patch0: term-fix-metadata.diff
# https://github.com/Stebalien/term/commit/84cfdb51775b327fedf21784749d862fdffa10b4
Patch1: 0001-fix-warning-due-to-use-of-env-home_dir.patch
ExclusiveArch: %{rust_arches}
BuildRequires: rust-packaging
# [dependencies]
BuildRequires: (crate(byteorder) >= 1.2.1 with crate(byteorder) < 2.0.0)
BuildRequires: (crate(dirs) >= 1.0.2 with crate(dirs) < 2.0.0)
%description
%{summary}.
@ -57,6 +62,9 @@ which use %{crate} from crates.io.
%exclude %{cargo_registry}/%{crate}-%{version}/{appveyor.yml,scripts}
%changelog
* Tue Sep 18 2018 Josh Stone <jistone@redhat.com> - 0.5.1-3
- Fix env::home_dir deprecation
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

@ -1,12 +0,0 @@
--- term-0.5.1/Cargo.toml 1970-01-01T01:00:00+01:00
+++ term-0.5.1/Cargo.toml 2018-05-10T11:28:36.959813+02:00
@@ -26,9 +26,6 @@
[features]
default = []
-[target."cfg(windows)".dependencies.winapi]
-version = "0.3"
-features = ["wincon", "handleapi", "fileapi"]
[badges.appveyor]
repository = "Stebalien/term"

@ -0,0 +1,17 @@
--- term-0.5.1/Cargo.toml 1969-12-31T16:00:00-08:00
+++ term-0.5.1/Cargo.toml 2018-09-17T12:37:33.128195-07:00
@@ -24,11 +24,11 @@
[dependencies.byteorder]
version = "1.2.1"
+[dependencies.dirs]
+version = "1.0.2"
+
[features]
default = []
-[target."cfg(windows)".dependencies.winapi]
-version = "0.3"
-features = ["wincon", "handleapi", "fileapi"]
[badges.appveyor]
repository = "Stebalien/term"
Loading…
Cancel
Save