Advertisement
elibelash

Untitled

Nov 25th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.79 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Text.RegularExpressions;
  6.  
  7. namespace Neuron.Python {
  8.     public sealed class Main : Script {
  9.         public override void Execute(string[] args) {
  10.             //Console.WriteLine(run_python("d:/helloworld.py"));
  11.             var pythonHomes = python_homes();
  12.             foreach (var pythonHomeInfo in pythonHomes) {
  13.                 Information("Found {0} at {1}", "Python" + pythonHomeInfo.Version, pythonHomeInfo.PythonHome);
  14.             }
  15.  
  16.             appendenv("PYTHONPATH", "D:\\neuron\\repository\\src\\pc-side\\neuronprotocol-python\\src");
  17.  
  18.             foreach (var pythonInfo in pythonHomes) {
  19.                 pythonInfo.setenvs(); //sets PYTHONHOME and PYTHONPATH
  20.                 Information(PythonInfo);
  21.                 python_version();
  22.                 cd_bin("../../");
  23.  
  24.                 using (cd_tmp("dist")) {
  25.                     mkdir("dist");
  26.                     del("./", "*.whl");
  27.                     del("./", "*.zip");
  28.                 }
  29.  
  30.                 Information(cd());
  31.  
  32.                 setenv("SRCPATH", relative("../../"));
  33.                 setenv("ROOT_PATH", getenv("SRCPATH"));
  34.                 setenv("DIST_PATH", relative("dist"));
  35.                 setenv("BOOST_ROOT", "D:\\local\\boost_1_70_0");
  36.  
  37.                 copyto("src", "dist");
  38.  
  39.                 Information("Python path: {0}", @where("python"));
  40.                 using (cd_tmp("dist")) {
  41.                     //run_python($"../python/build37.py bdist --help");
  42.                     //run_python($"../python/build37.py --help-commands");
  43.                     //run_python($"../python/build37.py build");
  44.                     pip_install("wheel");
  45.                     run_python($"../setup.py bdist bdist_dumb --format=zip --plat-name win32", throwOnError: false);
  46.                     run_python($"../setup.py bdist bdist_dumb --format=zip --plat-name win-amd64", throwOnError: false);
  47.                     moveto("dist", "./", true);
  48.                     del("dist");
  49.                     run_python("../setup.py bdist_wheel --universal --plat-name win32");
  50.                     run_python("../setup.py bdist_wheel --universal --plat-name win-amd64");
  51.                     moveto("dist", "./", true);
  52.                     copyto(selectfiles(".", "*.whl|*.zip"), "../out/");
  53.                 }
  54.  
  55.                 //using (cd_tmp("out")) {
  56.                 //    //todo proper check if build worked
  57.                 //    var whl = selectfiles(".", "*.whl").OrderByDescending(p => new FileInfo(p).CreationTimeUtc).FirstOrDefault();
  58.                 //    Information(install_whl(whl, Constants.PackageName));
  59.                 //}
  60.  
  61.                 Information("copying...");
  62.  
  63.                 clear_envs_cache();
  64.             }
  65.         }
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement