Skip to content
This repository has been archived by the owner on Jun 13, 2019. It is now read-only.

Commit

Permalink
Move to Python 3 by default
Browse files Browse the repository at this point in the history
Fixes #1.

This also moves the ec2-regions example to rusoto 0.25 to fix its build.
  • Loading branch information
iliana committed Jun 11, 2017
1 parent e4e53a2 commit 04ca5a1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
15 changes: 6 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,10 @@ exclude = [".gitignore", "builder", "examples"]

[dependencies]
serde_json = "1.0"
cpython = { version = "0.1", default-features = false }
cpython-json = { version = "0.2", default-features = false }

[dependencies.cpython]
version = "0.1"
default-features = false
features = ["python27-sys"]

[dependencies.cpython-json]
version = "0.2"
default-features = false
features = ["python27-sys"]
[features]
default = ["python3-sys"]
python27-sys = ["cpython/python27-sys", "cpython-json/python27-sys"]
python3-sys = ["cpython/python3-sys", "cpython-json/python3-sys"]
13 changes: 8 additions & 5 deletions examples/ec2-regions/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lambda-ec2-regions"
version = "0.1.2"
version = "0.2.0"
authors = ["Iliana Weller <[email protected]>"]

[lib]
Expand All @@ -9,9 +9,12 @@ crate-type = ["dylib"]

[dependencies]
# Normally you'd write: crowbar = "0.1"
crowbar = { path = "../..", version = "0.1" }
cpython = { version = "*", default-features = false, features = ["python27-sys"] }
rusoto = { version = "0.21", features = ["ec2"] }
crowbar = { path = "../..", version = "0.2", default-features = false }
cpython = { version = "0.1", default-features = false }
rusoto_core = "0.25"
rusoto_ec2 = "0.25"

[features]
unstable = ["rusoto/unstable"]
default = ["python3-sys"]
python27-sys = ["crowbar/python27-sys", "cpython/python27-sys"]
python3-sys = ["crowbar/python3-sys", "cpython/python3-sys"]
11 changes: 7 additions & 4 deletions examples/ec2-regions/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@
extern crate crowbar;
#[macro_use]
extern crate cpython;
extern crate rusoto;
extern crate rusoto_core;
extern crate rusoto_ec2;

use crowbar::{Value, LambdaContext, LambdaResult};
use rusoto::ec2::{Ec2Client, DescribeRegionsRequest};
use rusoto::{DefaultCredentialsProvider, Region};
use rusoto_core::{DefaultCredentialsProvider, Region, default_tls_client};
use rusoto_ec2::{Ec2, Ec2Client, DescribeRegionsRequest};
use std::default::Default;
use std::env;
use std::str::FromStr;

fn list_regions(_: Value, _: LambdaContext) -> LambdaResult {
let provider = DefaultCredentialsProvider::new()?;
let region_str = env::var("AWS_DEFAULT_REGION")?;
let client = Ec2Client::new(provider, Region::from_str(&region_str)?);
let client = Ec2Client::new(default_tls_client()?,
provider,
Region::from_str(&region_str)?);
let input: DescribeRegionsRequest = Default::default();

match client.describe_regions(&input)?.regions {
Expand Down
8 changes: 4 additions & 4 deletions examples/echo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "lambda-echo"
version = "0.1.2"
version = "0.2.0"
authors = ["Iliana Weller <[email protected]>"]

[lib]
name = "lambda"
crate-type = ["dylib"]

[dependencies]
# Normally you'd write: crowbar = "0.1"
crowbar = { path = "../..", version = "0.1" }
cpython = { version = "*", default-features = false, features = ["python27-sys"] }
# Normally you'd write: crowbar = "0.2"
crowbar = { path = "../..", version = "0.2" }
cpython = "0.1"

0 comments on commit 04ca5a1

Please sign in to comment.