Skip to content

Commit 7c60147

Browse files
committed
fix urlencode for publish
1 parent 4eb209f commit 7c60147

File tree

3 files changed

+37
-13
lines changed

3 files changed

+37
-13
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2025.1.5
1+
2025.1.6

mkdocs/docs/commands/bpm_run.md

+2
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ bpm run --bin "hello -y"
3838

3939
## Launch a command before the project program (only for bin program)
4040

41+
```bash
4142
$ mkdir scripts/
4243
$ echo "netchk" > scripts/network.sub
4344
$ bpm config set project orix_run_pre_script scripts/network.sub
4445
$ bpm run
46+
```
4547

4648
It will start scripts/network.sub and the main project binary

src/bpm

+34-12
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ import zipfile
1414
from io import BytesIO
1515
import shutil
1616
import glob
17+
import urllib.parse
1718

18-
VERSION_BPM = "2025.1.5"
19+
VERSION_BPM = "2025.1.6"
1920

2021
main_config_path = os.path.expanduser("~/.bpm/bpm")
2122
folder_path_md2hlp = os.path.expanduser("~/.bpm/md2hlp/")
@@ -322,6 +323,7 @@ def init_toml(args):
322323
content = content + f"default_generatedoc_version = \"{default_generatedoc_version}\"\n"
323324
content = content + f"orix_minimal_kernel_version = \"{default_kernel_version}\"\n"
324325
content = content + f"orix_run_pre_script = \"\"\n"
326+
content = content + f"md2hlp = \"yes\"\n"
325327
content = content + "\n[dependencies]\n"
326328
with open("bpm.tml", 'w') as file:
327329
file.write(content)
@@ -336,7 +338,7 @@ def init_toml(args):
336338
if codetype == 'bin':
337339
if not os.path.exists("src/" + last_directory + ".c"):
338340
print("Init " + "src/" + last_directory + ".c")
339-
content = "#include <stdio.h>\nint main() {\n printf(\"Hello word Orix\n\");\n return 0;\n}\n"
341+
content = "#include <stdio.h>\nint main() {\n printf(\"Hello word Orix\");\n return 0;\n}\n"
340342
with open("src/" + last_directory + ".c", 'w') as file:
341343
file.write(content)
342344

@@ -512,8 +514,6 @@ def build_package(source_dir, output_filename, name, version):
512514
# Créer le répertoire
513515
os.makedirs(f"build/usr/share/{name}/{version}", mode=0o755, exist_ok=True)
514516

515-
516-
517517
if not os.path.exists(f"src/include"):
518518
# Créer le répertoire
519519
os.makedirs(f"build/usr/include", mode=0o755, exist_ok=True)
@@ -539,10 +539,23 @@ def build_package(source_dir, output_filename, name, version):
539539
source_dir = "src/include/"
540540
destination_dir = "build/usr/include/"
541541

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+
542554
# 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")):
544556
# 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)
546559

547560
if os.path.exists("README.md"):
548561
shutil.copy("README.md", f"build/usr/share/{name}/{version}/README.md")
@@ -1071,16 +1084,18 @@ def manage_config(args):
10711084

10721085
valid_parameters_main_verify = ['path', 'boolean', 'string']
10731086

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']
10751088
valid_parameters_project_desc = [' Name of the project',
10761089
' Version of the project',
10771090
' Code type of the project (lib is a library, bin a command line [lib|bin]',
10781091
' Set False or True. False will not modify /etc/autoboot in Oricutron when bpm run is executed',
10791092
' Set Oricutron path for current project',
10801093
' 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']
10841099

10851100
# bpm set main -h
10861101
if len(args) == 5:
@@ -1281,9 +1296,9 @@ def publish(filename: str, args, mode):
12811296
if mode == "unpublish":
12821297
action = "delete"
12831298

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-
12861299
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
12871302
with open(filename, 'rb') as fichier:
12881303
fichiers = {filename: fichier} # Préparer le fichier pour l'envoi
12891304

@@ -1430,6 +1445,13 @@ def build_doc(toml_file):
14301445

14311446
if "package" in data:
14321447
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+
14331455
if "default_generatedoc_version" in package:
14341456
default_generatedoc_version = package["default_generatedoc_version"]
14351457
else:

0 commit comments

Comments
 (0)