Skip to content

Commit

Permalink
Added release_checklist and changelog. Prepare for release
Browse files Browse the repository at this point in the history
  • Loading branch information
David-OConnor committed Sep 4, 2019
1 parent 19800ad commit 2e0b519
Show file tree
Hide file tree
Showing 11 changed files with 161 additions and 142 deletions.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added CHANGELOG.md
Empty file.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -25,7 +25,7 @@ There are 2 ways to install:
On Windows, download and run
[This installer](https://github.com/David-OConnor/pypackage/releases/download/0.0.1/pypackage-0.0.2-x86_64.msi).

Alternatively, download the appropriate binary, and place it somewhere
Alternatively, download the appropriate binary (ie , and place it somewhere
accessible by the system path. For example, place it under `/usr/bin` in linux,
or `~\AppData\Local\Programs\Python\Python37\bin` in Windows.

Expand Down
17 changes: 17 additions & 0 deletions RELEASE_CHECKLIST.md
@@ -0,0 +1,17 @@
# Release Checklist

This is a list of steps to complete when making a new release.

1. Review the commit and PR history since last release. Ensure that all relevant
changes are included in `CHANGELOG.md`
1. Ensure the readme and homepage website reflects API changes.
1. Ensure the version listed in `Cargo.toml` is updated
1. Update Rust tools: `rustup update`
1. Run `cargo test`, `cargo fmt` and `cargo clippy`
1. Commit and push the repo
1. Check that CI pipeline passed
1. Run `cargo package` and `cargo publish` (Allows installation via cargo)
1. Run `cargo build --release` on Windows and Linux (to build binaries)
1. Run `cargo deb` on Linux, and `cargo wix` on Windows (to build installers)
1. Add a release on [Github](https://github.com/David-OConnor/seed/releases), following the format of previous releases.
1. Upload the following binaries to the release page: Windows binary, Linux binary, Msi, Deb
4 changes: 1 addition & 3 deletions src/commands.rs
Expand Up @@ -76,9 +76,7 @@ pub(crate) fn run_python(
util::set_pythonpath(lib_path);

// Run this way instead of setting current_dir, so we can load files from the right place.
Command::new(bin_path.join("python"))
.args(args)
.status()?;
Command::new(bin_path.join("python")).args(args).status()?;

Ok(())
}
127 changes: 65 additions & 62 deletions src/dep_resolution.rs
Expand Up @@ -241,10 +241,10 @@ fn fetch_req_data(
.into_iter()
.filter(|v| *v <= max_v_to_query)
.max()
{
Some(v) => vec![v],
None => vec![],
};
{
Some(v) => vec![v],
None => vec![],
};

query_data.insert(req.name.to_owned(), best_version);
}
Expand Down Expand Up @@ -337,7 +337,6 @@ fn guess_graph(
// into the dep resolution process is to avoid unecessary HTTP calls and resolution iterations.
for req in locked_reqs {
// Find the corresponding lock package. There should be exactly one.
let lnames: Vec<String> = locked.iter().map(|l| l.name.clone()).collect();
let package = locked
.iter()
.find(|p| util::compare_names(&p.name, &req.name))
Expand Down Expand Up @@ -439,9 +438,9 @@ fn find_constraints(
.reqs
.iter()
.filter(|r| util::compare_names(&r.name, &dep.name))
{
result.append(&mut req.constraints.clone())
}
{
result.append(&mut req.constraints.clone())
}
}
result
}
Expand All @@ -453,7 +452,7 @@ fn make_renamed_packs(
all_deps: &[Dependency],
name: &str,
) -> Vec<Package> {
// println!("DEBUG TEMP: {:#?}", &deps);
// println!("DEBUG TEMP: {:#?}", &deps);

util::print_color(
&format!(
Expand Down Expand Up @@ -538,7 +537,7 @@ pub fn resolve(
&mut version_cache,
&mut reqs_searched,
)
.is_err()
.is_err()
{
util::abort("Problem resolving dependencies");
}
Expand Down Expand Up @@ -614,8 +613,12 @@ pub fn resolve(

let newest_compatible = deps
.iter()
.filter(|dep|inter.iter().any(|i| i.0 <= dep.version && dep.version <= i.1))
.max_by(|a, b| a.version.cmp(&b.version));
.filter(|dep| {
inter
.iter()
.any(|i| i.0 <= dep.version && dep.version <= i.1)
})
.max_by(|a, b| a.version.cmp(&b.version));

match newest_compatible {
Some(best) => {
Expand Down Expand Up @@ -662,8 +665,8 @@ pub fn resolve(

// Generate dependencies here for all avail versions.
let unresolved_deps: Vec<Dependency> = versions
.into_iter()
.filter(|vers|inter.iter().any(|i| i.0 <= **vers && **vers <= i.1))
.iter()
.filter(|vers| inter.iter().any(|i| i.0 <= **vers && **vers <= i.1))
.map(|vers| Dependency {
id: 0, // placeholder; we'll assign an id to the one we pick.
name: fmtd_name.clone(),
Expand All @@ -673,7 +676,7 @@ pub fn resolve(
})
.collect();

// println!("Unresolved: {:#?}", &unresolved_deps);
// println!("Unresolved: {:#?}", &unresolved_deps);
let mut newest_unresolved = unresolved_deps
.into_iter()
.max_by(|a, b| a.version.cmp(&b.version))
Expand Down Expand Up @@ -703,7 +706,7 @@ pub fn resolve(
}
}

// Now, assign subdeps, so we can store them in the lock.
// Now, assign subdeps, so we can store them in the lock.
assign_subdeps(&mut result_cleaned, &updated_ids);

let mut a = result.clone();
Expand All @@ -720,8 +723,8 @@ pub mod tests {

#[test]
fn warehouse_versions() {
// Makes API call
// Assume no new releases since writing this test.
// Makes API call
// Assume no new releases since writing this test.
assert_eq!(
get_version_info("scinot").unwrap().2.sort(),
vec![
Expand All @@ -737,51 +740,51 @@ pub mod tests {
Version::new(0, 0, 10),
Version::new(0, 0, 11),
]
.sort()
.sort()
);
}

// #[test]
// fn warehouse_deps() {
// // Makes API call
// let req_part = |name: &str, reqs| {
// // To reduce repetition
// Req::new(name.to_owned(), version_reqs)
// };
// let vrnew = |t, ma, mi, p| Constraint::new(t, ma, mi, p);
// let vrnew_short = |t, ma, mi| Constraint {
// type_: t,
// major: ma,
// minor: Some(mi),
// patch: None,
// };
// use crate::dep_types::ReqType::{Gte, Lt, Ne};

// assert_eq!(
// _get_warehouse_dep_data("requests", &Version::new(2, 22, 0)).unwrap(),
// vec![
// req_part("chardet", vec![vrnew(Lt, 3, 1, 0), vrnew(Gte, 3, 0, 2)]),
// req_part("idna", vec![vrnew_short(Lt, 2, 9), vrnew_short(Gte, 2, 5)]),
// req_part(
// "urllib3",
// vec![
// vrnew(Ne, 1, 25, 0),
// vrnew(Ne, 1, 25, 1),
// vrnew_short(Lt, 1, 26),
// vrnew(Gte, 1, 21, 1)
// ]
// ),
// req_part("certifi", vec![vrnew(Gte, 2017, 4, 17)]),
// req_part("pyOpenSSL", vec![vrnew_short(Gte, 0, 14)]),
// req_part("cryptography", vec![vrnew(Gte, 1, 3, 4)]),
// req_part("idna", vec![vrnew(Gte, 2, 0, 0)]),
// req_part("PySocks", vec![vrnew(Ne, 1, 5, 7), vrnew(Gte, 1, 5, 6)]),
// req_part("win-inet-pton", vec![]),
// ]
// )

// todo Add more of these, for variety.
// }

// todo: Make dep-resolver tests, including both simple, conflicting/resolvable, and confliction/unresolvable.
// #[test]
// fn warehouse_deps() {
// // Makes API call
// let req_part = |name: &str, reqs| {
// // To reduce repetition
// Req::new(name.to_owned(), version_reqs)
// };
// let vrnew = |t, ma, mi, p| Constraint::new(t, ma, mi, p);
// let vrnew_short = |t, ma, mi| Constraint {
// type_: t,
// major: ma,
// minor: Some(mi),
// patch: None,
// };
// use crate::dep_types::ReqType::{Gte, Lt, Ne};

// assert_eq!(
// _get_warehouse_dep_data("requests", &Version::new(2, 22, 0)).unwrap(),
// vec![
// req_part("chardet", vec![vrnew(Lt, 3, 1, 0), vrnew(Gte, 3, 0, 2)]),
// req_part("idna", vec![vrnew_short(Lt, 2, 9), vrnew_short(Gte, 2, 5)]),
// req_part(
// "urllib3",
// vec![
// vrnew(Ne, 1, 25, 0),
// vrnew(Ne, 1, 25, 1),
// vrnew_short(Lt, 1, 26),
// vrnew(Gte, 1, 21, 1)
// ]
// ),
// req_part("certifi", vec![vrnew(Gte, 2017, 4, 17)]),
// req_part("pyOpenSSL", vec![vrnew_short(Gte, 0, 14)]),
// req_part("cryptography", vec![vrnew(Gte, 1, 3, 4)]),
// req_part("idna", vec![vrnew(Gte, 2, 0, 0)]),
// req_part("PySocks", vec![vrnew(Ne, 1, 5, 7), vrnew(Gte, 1, 5, 6)]),
// req_part("win-inet-pton", vec![]),
// ]
// )

// todo Add more of these, for variety.
// }

// todo: Make dep-resolver tests, including both simple, conflicting/resolvable, and confliction/unresolvable.
}
31 changes: 15 additions & 16 deletions src/dep_types.rs
Expand Up @@ -493,7 +493,7 @@ impl Constraint {
major -= 1;
minor = MAX_VER;
patch = MAX_VER;
// ie 2.9.0. Return max of 2.8.999999
// ie 2.9.0. Return max of 2.8.999999
} else if patch == 0 {
minor -= 1;
patch = MAX_VER
Expand Down Expand Up @@ -623,13 +623,12 @@ pub fn intersection_many(constrs: &[Constraint]) -> Vec<(Version, Version)> {
rng2 = (Version::new(0, 0, 0), Version::_max());
// We'll remove nes at the end.
nes.push(constr.version);
},
}
_ => {
rng2 = rng[0]; // If not Ne, there will be exactly 1.
rng2 = rng[0]; // If not Ne, there will be exactly 1.
}
}
ranges.push(rng2);

}
// todo: We haven't included nes!
intersection_many2(&ranges)
Expand Down Expand Up @@ -683,7 +682,7 @@ fn parse_extras(
let ex_re = Regex::new(
r#"(extra|sys_platform|python_version)\s*(\^|~|==|<=|>=|<|>|!=)\s*['"](.*?)['"]"#,
)
.unwrap();
.unwrap();

for caps in ex_re.captures_iter(extras) {
let type_ = caps.get(1).unwrap().as_str();
Expand All @@ -697,8 +696,9 @@ fn parse_extras(
ReqType::from_str(req_type).unwrap_or_else(|_| {
panic!("Problem parsing reqtype: {}", req_type)
}),
crate::Os::from_str(val)
.unwrap_or_else(|_| panic!("Problem parsing Os in extras: {}", val)),
crate::Os::from_str(val).unwrap_or_else(|_| {
panic!("Problem parsing Os in extras: {}", val)
}),
))
}
"python_version" => {
Expand Down Expand Up @@ -1154,7 +1154,7 @@ pub mod tests {
"pathlib2; extra == \"test\" and ( python_version == \"2.7\")",
true,
)
.unwrap();
.unwrap();

let expected2 = Req {
name: "pathlib2".into(),
Expand All @@ -1169,7 +1169,7 @@ pub mod tests {
"win-unicode-console (>=0.5) ; sys_platform == \"win32\" and python_version < \"3.6\"",
true,
)
.unwrap();
.unwrap();

let expected3 = Req {
name: "win-unicode-console".into(),
Expand Down Expand Up @@ -1385,12 +1385,11 @@ pub mod tests {
let reqs1 = vec![
Constraint::new(Exact, Version::new(4, 9, 4)),
Constraint::new(Gte, Version::new(4, 9, 7)),

];

let reqs2 = vec![
let reqs2 = vec![
Constraint::new(Lte, Version::new(4, 9, 6)),
Constraint::new(Gte, Version::new(4, 9, 7))
Constraint::new(Gte, Version::new(4, 9, 7)),
];

assert!(intersection_many(&reqs1).is_empty());
Expand Down Expand Up @@ -1420,19 +1419,19 @@ pub mod tests {
fn intersections_simple_many() {
let reqs1 = vec![
Constraint::new(Gte, Version::new(4, 9, 4)),
Constraint::new(Gte, Version::new(4, 3, 1))
Constraint::new(Gte, Version::new(4, 3, 1)),
];
let reqs2 = vec![
Constraint::new(Caret, Version::new(3, 0, 0)),
Constraint::new(Exact, Version::new(3, 3, 6))
Constraint::new(Exact, Version::new(3, 3, 6)),
];

assert_eq!(
intersection_many(&reqs1),
vec![(Version::new(4, 9, 4), Version::_max())]
);
assert_eq!(
intersection_many(&reqs2),
intersection_many(&reqs2),
vec![(Version::new(3, 3, 6), Version::new(3, 3, 6))]
);
}
Expand Down Expand Up @@ -1469,7 +1468,7 @@ pub mod tests {
Constraint::new(Ne, Version::new(2, 1, 2)),
Constraint::new(Ne, Version::new(2, 1, 6)),
Constraint::new(Gte, Version::new(2, 0, 1)),
Constraint::new(Gte, Version::new(2, 0, 2))
Constraint::new(Gte, Version::new(2, 0, 2)),
];

assert_eq!(
Expand Down
4 changes: 2 additions & 2 deletions src/files.rs
@@ -1,11 +1,11 @@
use crate::dep_types::Constraint;
use crate::{dep_types::Req, util, Config};
use crossterm::Color;
use regex::Regex;
use serde::Deserialize;
use std::collections::HashMap;
use std::fs;
use std::io::{BufRead, BufReader};
use crate::dep_types::Constraint;

/// This nested structure is required based on how the `toml` crate handles dots.
#[derive(Debug, Deserialize)]
Expand Down Expand Up @@ -73,7 +73,7 @@ pub struct Pypackage {
pub repository: Option<String>,
pub repo_url: Option<String>,
pub package_url: Option<String>,
pub readme_filename: Option<Option<String>>,
pub readme_filename: Option<String>,
pub entry_points: Option<HashMap<String, Vec<String>>>,
pub console_scripts: Option<Vec<String>>,

Expand Down

0 comments on commit 2e0b519

Please sign in to comment.