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

Generation script issues #356

Open
jtanx opened this issue Sep 8, 2017 · 0 comments
Open

Generation script issues #356

jtanx opened this issue Sep 8, 2017 · 0 comments

Comments

@jtanx
Copy link

jtanx commented Sep 8, 2017

So... While trying to debug fontforge/fontforge#3145 I ran into a few gems...

subprocess.Popen([scriptPath + '/sfnt2woff.exe', fontfile + '.ttf'], stdout=subprocess.PIPE)

  • Why are we using / in place of os.path.join?
  • Why are we Popening without waiting for it to finish??? Why not use subprocess.check_output? Why is it even piping stdout???
  • At least on Windows, a failure to run due to it being missing raises a FileNotFoundError instead of an OSError (one and the same)

subprocess.call(['sfnt2woff', fontfile + '.ttf'])

  • So now we're using subprocess.call instead of subprocess.Popen?

subprocess.call('python ' + scriptPath + '/eotlitetool.py ' + fontfile + '.ttf -o ' + fontfile + '.eot', shell=True)

  • Why are we calling python to run another python script, moreover one that is in this repo? How do we even know that the python that's called is the same python that's used to execute this script?
  • Why is shell=True?????

options, args = p.parse_args()

  • Hmm... let's read in the output file name

  • loljk I know better!

subprocess.call('move ' + fontfile + '.eotlite ' + fontfile + '.eot', shell=True)

  • WELL ACTUALLY LET'S MOVE THE FILE BACK TO WHAT I SAID IT SHOULD BE
  • USING A SHELL COMMAND
  • BECAUSE os.rename IS TOO HARD
  • BECAUSE FIXING eotlitetool.py IS TOO HARD

(apologies for the caps... by this point my mind was blown)

subprocess.call('woff2_compress \'' + fontfile + '.ttf\'', shell=True)

  • What's with all these shell commands? Single quoting e.g. woff2_compress 'blah.ttf' just doesn't work on Windows/cmd.exe

I'm done...

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

No branches or pull requests

1 participant