Last active
August 29, 2015 14:02
-
-
Save yejianye/74f69651aa3b009df24b to your computer and use it in GitHub Desktop.
Auto-evaluate variables in a string, especially useful when writing a shell-scripts in Python
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
from fabric.api import local | |
def sh(command, *args, **kwargs): | |
frame = inspect.currentframe() | |
ctx = frame.f_back.f_globals.copy() | |
ctx.update(frame.f_back.f_locals) | |
command = command.format(**ctx) | |
del frame | |
return local(command, *args, **kwargs) | |
def resign_ipa(uapp_name, unsigned_app, target_dir): | |
sh('mkdir -p {target_dir}/Payload') | |
sh('cp -r "{unsigned_app}" {target_dir}/Payload') | |
sh('rm -rf {target_dir}/{app_name}.app/_CodeSignature') | |
... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment