Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

yodeng/ccbuild

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ccbuild

PyPI version

ccbuildpython开发的项目、流程或脚本文件进行编译成C的动态共享库*.so文件,不影响项目运行,可用于某些场景下python源码保护。

依赖

  • Linux
  • Python >=3.5
  • cython

安装

git repo with the development version

pip install git+https://github.com/yodeng/ccbuild.git

Pypi

pip install -U ccbuild

使用

$ ccbuild -h 

相关参数解释如下:

参数 描述
-h/--help 打印帮助并退出
-p/--python 编译后运行项目使用的python解释器路径,非绝对路径会从$PATH中查找
-i/--input 需要编译的py文件或项目目录
-o/--output 编译后的项目或文件输出路径
-t/--threads cpu核数,默认5
-c/--compile-continue 若某个文件编译失败,是否跳过,继续编译,默认编译失败退出程序
--exclude-dir 跳过的编译目录,默认"__pycache__"会被跳过, 多个输入空白隔开,支持简单shell匹配
--exclude-file 跳过的编译文件,默认"__init__.py"会被跳过,多个输入空白隔开,支持简单shell匹配
-d/--debug debug模式,此模式下,编译错误时,会打印编译错误的原因,用于错误排查
-v/--version 打印版本并退出
  • -p/--python指定的解释器为编译后运行项目的解释器,相同版本的解释器可以通用

说明

  • 编译后的输出目录,使用方式不变,只是项目中的py文件变成了so二进制文件。

  • 有可能存在编译失败的情况,原因通常是由于python代码中有无效代码块,其中使用了未定义的变量或模块,cython会当做错误,cythonpython并不是百分百兼容,可通过debug模式查看和解决错误。

About

build *.py file to *.so for python source code protection

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.