11import tomllib
2- import argparse
32import os
43import subprocess
54import shutil
65import glob
7- import logging
86from typing import Any
97from pathlib import Path
108
119import yaml
1210import typer
1311
14- logger = logging .getLogger (__name__ )
1512
1613app = typer .Typer ()
1714
@@ -43,7 +40,7 @@ def __enter__(self) -> Path:
4340 def __exit__ (self , exc_type : Any , exc_value : Any , traceback : Any ) -> None :
4441 if TEMP_DIR .exists ():
4542 shutil .rmtree (TEMP_DIR )
46- logger . info ("Temporary build directory removed." )
43+ print ("Temporary build directory removed." )
4744
4845
4946def format_dependency (name : str , version : str ) -> str :
@@ -81,7 +78,7 @@ def generate_recipe() -> None:
8178 }
8279
8380 # Populate package information
84- package_name = PROJECT_CONFIG ["package" ]["name" ]. replace ( "-" , "_" )
81+ package_name = PROJECT_CONFIG ["package" ]["name" ]
8582 recipe ["package" ]["name" ] = package_name
8683 recipe ["package" ]["version" ] = PROJECT_CONFIG ["package" ]["version" ]
8784
@@ -113,8 +110,9 @@ def generate_recipe() -> None:
113110@app .command ()
114111def publish (channel : str ) -> None :
115112 """Publishes the conda packages to the specified conda channel."""
116- logger .info (f"Publishing packages to: { channel } " )
117- for file in glob .glob (f'{ CONDA_BUILD_PATH } /**/*.conda' ):
113+ print (f"Publishing packages to: { channel } , from { CONDA_BUILD_PATH } ." )
114+ for file in glob .glob (f'{ CONDA_BUILD_PATH } /*.conda' ):
115+ print (f"Uploading { file } to { channel } ..." )
118116 try :
119117 subprocess .run (
120118 ["pixi" , "upload" , f"https://prefix.dev/api/v1/upload/{ channel } " , file ],
@@ -128,7 +126,7 @@ def publish(channel: str) -> None:
128126def remove_temp_directory () -> None :
129127 """Removes the temporary directory used for building the package."""
130128 if TEMP_DIR .exists ():
131- logger . info ("Removing temp directory." )
129+ print ("Removing temp directory." )
132130 shutil .rmtree (TEMP_DIR )
133131
134132
@@ -148,13 +146,13 @@ def run_tests(path: str | None = None) -> None:
148146 """Executes the tests for the package."""
149147 TEST_DIR = Path ("src/test" )
150148
151- logger . info ("Building package and copying tests." )
149+ print ("Building package and copying tests." )
152150 with TemporaryBuildDirectory () as temp_directory :
153151 shutil .copytree (TEST_DIR , temp_directory , dirs_exist_ok = True )
154152 target = temp_directory
155153 if path :
156154 target = target / path
157- logger . info (f"Running tests at { target } ..." )
155+ print (f"Running tests at { target } ..." )
158156 subprocess .run (["mojo" , "test" , target ], check = True )
159157
160158
@@ -163,17 +161,17 @@ def run_examples(path: str | None = None) -> None:
163161 """Executes the examples for the package."""
164162 EXAMPLE_DIR = Path ("examples" )
165163 if not EXAMPLE_DIR .exists ():
166- logger . info (f"Path does not exist: { EXAMPLE_DIR } ." )
164+ print (f"Path does not exist: { EXAMPLE_DIR } ." )
167165 return
168166
169- logger . info ("Building package and copying examples." )
167+ print ("Building package and copying examples." )
170168 with TemporaryBuildDirectory () as temp_directory :
171169 shutil .copytree (EXAMPLE_DIR , temp_directory , dirs_exist_ok = True )
172170 example_files = EXAMPLE_DIR .glob ("*.mojo" )
173171 if path :
174172 example_files = EXAMPLE_DIR .glob (path )
175173
176- logger . info (f"Running examples in { example_files } ..." )
174+ print (f"Running examples in { example_files } ..." )
177175 for file in example_files :
178176 name , _ = file .name .split ("." , 1 )
179177 shutil .copyfile (file , temp_directory / file .name )
@@ -185,17 +183,17 @@ def run_examples(path: str | None = None) -> None:
185183def run_benchmarks (path : str | None = None ) -> None :
186184 BENCHMARK_DIR = Path ("benchmarks" )
187185 if not BENCHMARK_DIR .exists ():
188- logger . info (f"Path does not exist: { BENCHMARK_DIR } ." )
186+ print (f"Path does not exist: { BENCHMARK_DIR } ." )
189187 return
190188
191- logger . info ("Building package and copying benchmarks." )
189+ print ("Building package and copying benchmarks." )
192190 with TemporaryBuildDirectory () as temp_directory :
193191 shutil .copytree (BENCHMARK_DIR , temp_directory , dirs_exist_ok = True )
194192 benchmark_files = BENCHMARK_DIR .glob ("*.mojo" )
195193 if path :
196194 benchmark_files = BENCHMARK_DIR .glob (path )
197195
198- logger . info (f"Running benchmarks in { benchmark_files } ..." )
196+ print (f"Running benchmarks in { benchmark_files } ..." )
199197 for file in benchmark_files :
200198 name , _ = file .name .split ("." , 1 )
201199 shutil .copyfile (file , temp_directory / file .name )
0 commit comments