forked from pykeio/ort
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: cherry pick the fix for
download-binaries
(#10)
Fixes the problem where building multiple ort-sys `download-binaries` fail. Cherry picked from eb51646, eb51646, and pykeio#323. Refs: VOICEVOX/voicevox_core#859, pykeio#322 Refs: eb51646 Refs: effd7a7, pykeio#323 Co-authored-by: Carson M. <[email protected]>
- Loading branch information
1 parent
69ac04c
commit 17f7413
Showing
3 changed files
with
46 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
use std::hash::{BuildHasher, Hasher, RandomState}; | ||
|
||
pub mod dirs; | ||
|
||
#[cfg(feature = "download-binaries")] | ||
include!(concat!(env!("OUT_DIR"), "/downloaded_version.rs")); | ||
pub fn random_identifier() -> String { | ||
let mut state = RandomState::new().build_hasher().finish(); | ||
std::iter::repeat_with(move || { | ||
state ^= state << 13; | ||
state ^= state >> 7; | ||
state ^= state << 17; | ||
state | ||
}) | ||
.take(12) | ||
.map(|i| b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[i as usize % 62] as char) | ||
.collect() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters