Advertisement
elibelash

Untitled

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