Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
516 views
in Technique[技术] by (71.8m points)

cython - Cant run setup/cythonize from python file

I'm tyring to cythonize lots of py files in a loop function it goes something like:

        from setuptools.command.build_ext import build_ext as _build_ext
  for module in moduleList:
        setuptools.setup(cmdclass={"build_ext": _build_ext},
                         ext_modules=cythonize(module[1])
                         #or
                         #ext_modules=cythonize(
                         #    Extension(module[0],sources=[module[1]])
                                               ), 
                        )

All I get is

usage: build_clean.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: build_clean.py --help [cmd1 cmd2 ...]
   or: build_clean.py --help-commands
   or: build_clean.py cmd --help

error: no commands supplied

What am I doing wrong here ? :- (

EDIT : I have a feeling I'm missing the "explanation" of the issue so let me give it another go...

I have "BUILD" script that does tuff like this :

copyFile(xx,yy)
copyFile(yy,dd)
copeFile()

fileArr = []
for dir,fol,fil in os.walk(path):
    for file in fil:
        fileArr.append((fil,dir+"/"+file))
more work
more stuff
more lalala

for entry in fileArr :
    setup(name="lets cythonize",
          ext_modules=cythonize(Extension(entry[0],sources=[entry[1]]))
    ))

print("Job done yay")

I have to encapsulate half of the script in

 myScript = """
 import setuptools

 for file in entryList:
         setup(name="lets cythonize",
          ext_modules=cythonize(Extension(entry[0],sources=[entry[1]]))
    ))
 etc etc
 """
 f = open(path,"w")
 f.write(myScript)
 f.close()
 subprocess.call("env/python",path,"build_ext")

And thats what frustrating, I cant just "run" it from ide. It has to be run from cmd/terminal/etc...

question from:https://stackoverflow.com/questions/65874475/cant-run-setup-cythonize-from-python-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...