@@ -14,8 +14,9 @@ import zipfile
14
14
from io import BytesIO
15
15
import shutil
16
16
import glob
17
+ import urllib .parse
17
18
18
- VERSION_BPM = "2025.1.5 "
19
+ VERSION_BPM = "2025.1.6 "
19
20
20
21
main_config_path = os .path .expanduser ("~/.bpm/bpm" )
21
22
folder_path_md2hlp = os .path .expanduser ("~/.bpm/md2hlp/" )
@@ -322,6 +323,7 @@ def init_toml(args):
322
323
content = content + f"default_generatedoc_version = \" { default_generatedoc_version } \" \n "
323
324
content = content + f"orix_minimal_kernel_version = \" { default_kernel_version } \" \n "
324
325
content = content + f"orix_run_pre_script = \" \" \n "
326
+ content = content + f"md2hlp = \" yes\" \n "
325
327
content = content + "\n [dependencies]\n "
326
328
with open ("bpm.tml" , 'w' ) as file :
327
329
file .write (content )
@@ -336,7 +338,7 @@ def init_toml(args):
336
338
if codetype == 'bin' :
337
339
if not os .path .exists ("src/" + last_directory + ".c" ):
338
340
print ("Init " + "src/" + last_directory + ".c" )
339
- content = "#include <stdio.h>\n int main() {\n printf(\" Hello word Orix\n \ " );\n return 0;\n }\n "
341
+ content = "#include <stdio.h>\n int main() {\n printf(\" Hello word Orix\" );\n return 0;\n }\n "
340
342
with open ("src/" + last_directory + ".c" , 'w' ) as file :
341
343
file .write (content )
342
344
@@ -512,8 +514,6 @@ def build_package(source_dir, output_filename, name, version):
512
514
# Créer le répertoire
513
515
os .makedirs (f"build/usr/share/{ name } /{ version } " , mode = 0o755 , exist_ok = True )
514
516
515
-
516
-
517
517
if not os .path .exists (f"src/include" ):
518
518
# Créer le répertoire
519
519
os .makedirs (f"build/usr/include" , mode = 0o755 , exist_ok = True )
@@ -539,10 +539,23 @@ def build_package(source_dir, output_filename, name, version):
539
539
source_dir = "src/include/"
540
540
destination_dir = "build/usr/include/"
541
541
542
+ for root , _ , files in os .walk (source_dir ):
543
+ for file in files :
544
+ if file .endswith (".h" ): # Filtrer les fichiers .h
545
+ full_path = os .path .join (root , file )
546
+ extracted = full_path .split (source_dir , 1 )[1 ]
547
+ before_last_slash , _ , _ = extracted .rpartition ("/" )
548
+ if not os .path .exists (f"{ destination_dir } /{ before_last_slash } " ):
549
+ # Créer le répertoire
550
+ os .makedirs (f"{ destination_dir } /{ before_last_slash } " , mode = 0o755 , exist_ok = True )
551
+ print (f"{ destination_dir } /{ extracted } " )
552
+ shutil .copy (full_path , f"{ destination_dir } /{ extracted } " )
553
+
542
554
# Récupère tous les fichiers .inc dans le répertoire source
543
- for file_path in glob .glob (os .path .join (source_dir , "*.h" )):
555
+ # for file_path in glob.glob(os.path.join(source_dir, "*.h")):
544
556
# Copie chaque fichier vers le répertoire de destination
545
- shutil .copy (file_path , destination_dir )
557
+ # print(f"Copy {file_path} to {destination_dir}")
558
+ # shutil.copy(file_path, destination_dir)
546
559
547
560
if os .path .exists ("README.md" ):
548
561
shutil .copy ("README.md" , f"build/usr/share/{ name } /{ version } /README.md" )
@@ -1071,16 +1084,18 @@ def manage_config(args):
1071
1084
1072
1085
valid_parameters_main_verify = ['path' , 'boolean' , 'string' ]
1073
1086
1074
- valid_parameters_project = ['name' , 'version' , 'codetype' , 'oricutron_replace_autoboot_run' , 'oricutron_path' , 'default_rom_oricutron_for_code' , 'orix_run_pre_script' ]
1087
+ valid_parameters_project = ['name' , 'version' , 'codetype' , 'oricutron_replace_autoboot_run' , 'oricutron_path' , 'default_rom_oricutron_for_code' , 'orix_run_pre_script' , 'md2hlp' ]
1075
1088
valid_parameters_project_desc = [' Name of the project' ,
1076
1089
' Version of the project' ,
1077
1090
' Code type of the project (lib is a library, bin a command line [lib|bin]' ,
1078
1091
' Set False or True. False will not modify /etc/autoboot in Oricutron when bpm run is executed' ,
1079
1092
' Set Oricutron path for current project' ,
1080
1093
' Default rom when code type is rom : the .rom will be inserted into this slot' ,
1081
- ' Pre submit script : will be added before project command'
1082
- ]
1083
- valid_parameters_project_verify = ['string' , 'string' , 'values=bin,lib' ,'boolean' , 'string' , 'string' , 'string' ]
1094
+ ' Pre submit script : will be added before project command' ,
1095
+ ' Activate md2hlp : enable set to yer, disabled set to no'
1096
+ ]
1097
+
1098
+ valid_parameters_project_verify = ['string' , 'string' , 'values=bin,lib' ,'boolean' , 'string' , 'string' , 'string' , 'string' ]
1084
1099
1085
1100
# bpm set main -h
1086
1101
if len (args ) == 5 :
@@ -1281,9 +1296,9 @@ def publish(filename: str, args, mode):
1281
1296
if mode == "unpublish" :
1282
1297
action = "delete"
1283
1298
1284
- url = f"http://api.orix.oric.org/v1/libtgz?cpu={ cpu } &repo={ repo } &version={ version } &name={ name } &codetype={ codetype } &action={ action } &description={ description } &key=" + publish_key
1285
-
1286
1299
if mode == "publish" :
1300
+ encoded_description = urllib .parse .quote (description )
1301
+ url = f"http://api.orix.oric.org/v1/libtgz?cpu={ cpu } &repo={ repo } &version={ version } &name={ name } &codetype={ codetype } &action={ action } &description={ encoded_description } &key=" + publish_key
1287
1302
with open (filename , 'rb' ) as fichier :
1288
1303
fichiers = {filename : fichier } # Préparer le fichier pour l'envoi
1289
1304
@@ -1430,6 +1445,13 @@ def build_doc(toml_file):
1430
1445
1431
1446
if "package" in data :
1432
1447
package = data ["package" ]
1448
+
1449
+ if "md2hlp" in package :
1450
+ if package ["md2hlp" ] == 'no' :
1451
+ md2hlp_generate = False
1452
+ else :
1453
+ md2hlp_generate = True
1454
+
1433
1455
if "default_generatedoc_version" in package :
1434
1456
default_generatedoc_version = package ["default_generatedoc_version" ]
1435
1457
else :
0 commit comments