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

Need a tutorial for running and transpiling youtube-dl #133

Open
joeky888 opened this issue Feb 8, 2019 · 5 comments
Open

Need a tutorial for running and transpiling youtube-dl #133

joeky888 opened this issue Feb 8, 2019 · 5 comments

Comments

@joeky888
Copy link

joeky888 commented Feb 8, 2019

Would you document a tutorial for running and transpiling a complete project like youtube-dl.

The dependencies of youtube-dl are only Python and Python-setuptools.

$ cd youtube-dl
$ grumpc youtube_dl/__main__.py
package __main__
import (
        πg "grumpy"
        // _ "__python__/sys"
        // _ "__python__/os"
        // _ "__python__/os/path"
)
var Code *πg.Code
func init() {
...
$ What to do next?

It would be amazing if there is a tutorial for compiling youtube-dl to a static binary.

@alanjds
Copy link

alanjds commented Feb 8, 2019

I really should rewrite the outdated readme, but mainly is to install on the virtualenv and then

$ grumpy run youtube_dl/__main__.py

You can see internals using the -v debug flag, if you want:

$ grumpy -v debug run youtube_dl/__main__.py

When it got worked, can keep the binary with the flag --go-action build of run

$ grumpy run --go-action build youtube_dl/__main__.py

Btw, thanks for asking.

Let me know if it worked or not, ok?

@joeky888
Copy link
Author

joeky888 commented Feb 9, 2019

grumpy run youtube_dl/main.py

I stuck on the first step.

$ git clone --depth 1 https://github.com/rg3/youtube-dl /tmp/youtube-dl
$ cd /tmp/youtube-dl
$ # Remove from __future__ import division
$ find . -type f -exec sed -i -e 's/,\s*division//g' {} \;
$ find . -type f -exec sed -i -e 's/division\s*,//g' {} \;
$ python2 youtube_dl/__main__.py # Looks good.
Usage: __main__.py [OPTIONS] URL [URL...]

__main__.py: error: You must provide at least one URL.
Type youtube-dl --help to see a list of all options.

$ grumpy run youtube_dl/__main__.py # Not good.
../tmpIYBaGy__pycache__/gopath/src/__python__/main.go:60:2: no Go files in /usr/lib/python2.7/ctypes/macholib/__pycache__/dyld.grumpy-022.pyc/gopath/src/__python__/ctypes/macholib
../tmpIYBaGy__pycache__/gopath/src/__python__/main.go:69:2: no Go files in /usr/lib/python2.7/distutils/__pycache__/errors.grumpy-022.pyc/gopath/src/__python__/distutils
../tmpIYBaGy__pycache__/gopath/src/__python__/main.go:186:2: no Go files in /usr/lib/python2.7/xml/parsers/__pycache__/expat.grumpy-022.pyc/gopath/src/__python__/xml
../tmpIYBaGy__pycache__/gopath/src/__python__/main.go:187:2: no Go files in /usr/lib/python2.7/xml/etree/__pycache__/ElementTree.grumpy-022.pyc/gopath/src/__python__/xml/etree
../tmpIYBaGy__pycache__/gopath/src/__python__/main.go:190:2: no Go files in /usr/lib/python2.7/xml/parsers/__pycache__/expat.grumpy-022.pyc/gopath/src/__python__/xml/parsers

@alanjds
Copy link

alanjds commented Feb 11, 2019

Yeah. Grumpy does not support C-based modules right now (and probable never be). It runs pure-python only code. The ctypes module your code needs is C-based.

The alternatives are to reimplement the interfaces in pure-python or Go-based modules.

Just to say, I would imagine that Cython-based WOULD be possible to be supported, if it does not interfaces with the CPython C-API, but nobody started this effort.

@alanjds
Copy link

alanjds commented Feb 11, 2019

For example, my own pet task on this project right now is to reimplement _codecs module in pure-python, as the CPython version is C-based, thus unusable on Grumpy.

The expected outcome is to be able to run zipfile module, that needs _codecs.

@joeky888
Copy link
Author

Thanks, I guess this is why annie comes out :)

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

2 participants