Created
July 28, 2025 13:31
-
-
Save QiangF/988fca0b1718d24ba4c0adb630fba4c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # symlinking.py need to be run under the root dir of the script | |
| import os | |
| from os import path, system | |
| def symlink(symlink_dir, symlink_name, relative_target_path): | |
| print("make symlink {} to {}".format(symlink_name, relative_target_path)) | |
| symlink = path.join(symlink_dir, symlink_name) | |
| if path.realpath(symlink) == path.realpath(relative_target_path): | |
| print("Already linked: {}".format(symlink)) | |
| else: | |
| try: | |
| os.remove(symlink) | |
| except: | |
| pass | |
| # check if target exist | |
| if path.exists(relative_target_path): | |
| command = " ".join(["ln -rsf", relative_target_path, symlink_dir + symlink_name]) | |
| print("command is {}".format(command)) | |
| system(command) | |
| else: | |
| print("!! Target doesn't exist: {}".format(relative_target_path)) | |
| def pyroll_link(i, symlink_name): | |
| symlink_dir = "./pyroll/" | |
| relative_target_path = "./src/pyroll-{}/pyroll/{}".format(i,symlink_name) | |
| symlink(symlink_dir, symlink_name, relative_target_path) | |
| print("Removing symlinks in pyroll dir to get rid of unused symlinks.") | |
| system("rm ./pyroll/*") | |
| # dir module | |
| for i in ["core", | |
| "export", | |
| "byon_lee_wear_model", | |
| "freiberg-flow-stress", | |
| "integral-thermal", | |
| "jmak-recrystallization", | |
| 'lendl-equivalent-method', | |
| 'pillar-model', | |
| "profile-bulging", | |
| "report", | |
| "ring-model-thermal", | |
| ]: | |
| j=i.replace("-","_") | |
| pyroll_link(i, j) | |
| # single file module under subdir | |
| for i in ["basic", | |
| "hill-spreading", | |
| "interface-friction", | |
| "lippmann-mahrenholz-force-torque", | |
| "marini-spreading", | |
| "ring-model", | |
| "roux-spreading", | |
| "sander-spreading", | |
| "sparling-spreading", | |
| "tension-spreading-interaction", | |
| "wusatowski-spreading", | |
| "zouhar-contact", ]: | |
| j=i.replace("-","_") + '.py' | |
| pyroll_link(i, j) | |
| symlink("./pyroll/", "hensel_force_torque.py", "./src/pyroll-hensel-power-and-labour/pyroll/hensel_force_torque.py",) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment