Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add options: format/style/rebuild into generate.py #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yuezheng
Copy link

  1. Add format option;
  2. Add style option;
  3. Add rebuild option to skip exist output file.

1. Add format option;
2. Add style option;
3. Add rebuild option to skip exist output file.

parser = OptionParser()
parser.add_option("-r", "--rebuild", dest="rebuild", default=False,
help="Rebuild exist output image")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this option don't need any additional argument, so is it better to set it action to store_true ?


work_path = os.getcwd() + "/"
output_file_name = src_file[:src_file.rindex('.') + 1] + format
target_full_path = work_path + target_path + "/" + output_file_name
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need get absolute path again, you can use os.path.abspath or os.path.realpath to convert to absolute path.

abspath = os.path.abspath(target_path + output_file)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants