@@ -21,7 +21,7 @@ public static async Task InstallPackage()
21
21
{
22
22
VerifyVirtualEnvironment ( ) ;
23
23
await VerifyVersion ( ) ;
24
- // await InstallPipWheel();
24
+ await InstallPipWheel ( ) ;
25
25
await InstallPythonAzureFunctionPackage ( ) ;
26
26
await PipFreeze ( ) ;
27
27
}
@@ -34,21 +34,6 @@ public static void VerifyVirtualEnvironment()
34
34
}
35
35
}
36
36
37
- private static async Task InstallPythonAzureFunctionPackage ( )
38
- {
39
- foreach ( var package in _workerPackages )
40
- {
41
- ColoredConsole . WriteLine ( "Installing azure-functions package" ) ;
42
- var exe = new Executable ( "pip" , $ "install \" { package } \" ") ;
43
- var sb = new StringBuilder ( ) ;
44
- var exitCode = await exe . RunAsync ( l => sb . AppendLine ( l ) , e => sb . AppendLine ( e ) ) ;
45
- if ( exitCode != 0 )
46
- {
47
- throw new CliException ( $ "Error installing azure package \n { sb . ToString ( ) } ") ;
48
- }
49
- }
50
- }
51
-
52
37
private static async Task PipFreeze ( string path = null )
53
38
{
54
39
var sb = new StringBuilder ( ) ;
@@ -68,27 +53,23 @@ private static async Task PipFreeze(string path = null)
68
53
}
69
54
}
70
55
71
- public static async Task InstallPipWheel ( )
56
+ private static Task InstallPythonAzureFunctionPackage ( ) => PipInstallPackages ( _workerPackages ) ;
57
+
58
+ private static Task InstallPipWheel ( ) => PipInstallPackage ( "wheel" ) ;
59
+
60
+ private static Task PipInstallPackages ( IEnumerable < string > packageNames ) => Task . WhenAll ( packageNames . Select ( PipInstallPackage ) ) ;
61
+
62
+ private static async Task PipInstallPackage ( string packageName )
72
63
{
73
- ColoredConsole . WriteLine ( "Installing wheel package" ) ;
74
- var exe = new Executable ( "pip" , "install wheel " ) ;
64
+ ColoredConsole . WriteLine ( $ "Installing { packageName } package") ;
65
+ var exe = new Executable ( "pip" , $ "install { packageName } ") ;
75
66
var sb = new StringBuilder ( ) ;
76
67
var exitCode = await exe . RunAsync ( l => sb . AppendLine ( l ) , e => sb . AppendLine ( e ) ) ;
77
68
if ( exitCode != 0 )
78
69
{
79
70
throw new CliException ( $ "Error running '{ exe . Command } '. { sb . ToString ( ) } ") ;
80
71
}
81
- }
82
72
83
- public static async Task DownloadWheels ( )
84
- {
85
- ColoredConsole . WriteLine ( "Downloading wheels from requirements.txt to .wheels dir" ) ;
86
- var exe = new Executable ( "pip" , "wheel --wheel-dir=.wheels -r requirements.txt" ) ;
87
- var exitCode = await exe . RunAsync ( l => ColoredConsole . WriteLine ( l ) , e => ColoredConsole . Error . WriteLine ( ErrorColor ( e ) ) ) ;
88
- if ( exitCode != 0 )
89
- {
90
- throw new CliException ( $ "Error running '{ exe . Command } '.") ;
91
- }
92
73
}
93
74
94
75
private static async Task VerifyVersion ( )
0 commit comments