rust/hgcli/build.rs
changeset 43818 ce088b38f92b
parent 35607 24b5106e3e1e
child 44729 26ce8e751503
equal deleted inserted replaced
43817:d9f85f61f0ed 43818:ce088b38f92b
    16 }
    16 }
    17 
    17 
    18 fn get_python_config() -> PythonConfig {
    18 fn get_python_config() -> PythonConfig {
    19     // The python27-sys crate exports a Cargo variable defining the full
    19     // The python27-sys crate exports a Cargo variable defining the full
    20     // path to the interpreter being used.
    20     // path to the interpreter being used.
    21     let python = env::var("DEP_PYTHON27_PYTHON_INTERPRETER").expect(
    21     let python = env::var("DEP_PYTHON27_PYTHON_INTERPRETER")
    22         "Missing DEP_PYTHON27_PYTHON_INTERPRETER; bad python27-sys crate?",
    22         .expect("Missing DEP_PYTHON27_PYTHON_INTERPRETER; bad python27-sys crate?");
    23     );
       
    24 
    23 
    25     if !Path::new(&python).exists() {
    24     if !Path::new(&python).exists() {
    26         panic!(
    25         panic!(
    27             "Python interpreter {} does not exist; this should never happen",
    26             "Python interpreter {} does not exist; this should never happen",
    28             python
    27             python
    31 
    30 
    32     // This is a bit hacky but it gets the job done.
    31     // This is a bit hacky but it gets the job done.
    33     let separator = "SEPARATOR STRING";
    32     let separator = "SEPARATOR STRING";
    34 
    33 
    35     let script = "import sysconfig; \
    34     let script = "import sysconfig; \
    36 c = sysconfig.get_config_vars(); \
    35                   c = sysconfig.get_config_vars(); \
    37 print('SEPARATOR STRING'.join('%s=%s' % i for i in c.items()))";
    36                   print('SEPARATOR STRING'.join('%s=%s' % i for i in c.items()))";
    38 
    37 
    39     let mut command = Command::new(&python);
    38     let mut command = Command::new(&python);
    40     command.arg("-c").arg(script);
    39     command.arg("-c").arg(script);
    41 
    40 
    42     let out = command.output().unwrap();
    41     let out = command.output().unwrap();