Add a Rust project.
This commit is contained in:
parent
c0d5d7ab0d
commit
f8b4ef7698
6 changed files with 65 additions and 33 deletions
|
@ -38,57 +38,46 @@ security-check:
|
||||||
- pip3 install safety
|
- pip3 install safety
|
||||||
- safety check -r requirements.txt
|
- safety check -r requirements.txt
|
||||||
|
|
||||||
pytest-3.7:
|
.poezio-tests:
|
||||||
stage: test
|
|
||||||
image: python:3.7
|
|
||||||
script:
|
script:
|
||||||
- apt-get update && apt-get install -y libidn11-dev
|
- apt-get update && apt-get install -y libidn11-dev
|
||||||
|
- wget https://static.rust-lang.org/rustup/archive/1.24.3/x86_64-unknown-linux-gnu/rustup-init
|
||||||
|
- chmod +x rustup-init
|
||||||
|
- ./rustup-init -y --no-modify-path --default-toolchain nightly
|
||||||
|
- rm rustup-init
|
||||||
|
- ls ~/.cargo/bin
|
||||||
|
- export PATH=$PATH:$HOME/.cargo/bin
|
||||||
- git clone https://lab.louiz.org/poezio/slixmpp.git
|
- git clone https://lab.louiz.org/poezio/slixmpp.git
|
||||||
- pip3 install pytest pyasn1-modules cffi --upgrade
|
- pip3 install pytest pyasn1-modules cffi setuptools-rust --upgrade
|
||||||
- cd slixmpp
|
- cd slixmpp
|
||||||
- python3 setup.py install
|
- python3 setup.py install
|
||||||
- cd ..
|
- cd ..
|
||||||
- python3 setup.py install
|
- python3 setup.py install
|
||||||
- py.test -v test/
|
- py.test -v test/
|
||||||
|
|
||||||
|
pytest-3.7:
|
||||||
|
stage: test
|
||||||
|
image: python:3.7
|
||||||
|
extends:
|
||||||
|
- .poezio-tests
|
||||||
|
|
||||||
pytest-3.8:
|
pytest-3.8:
|
||||||
stage: test
|
stage: test
|
||||||
image: python:3.8
|
image: python:3.8
|
||||||
script:
|
extends:
|
||||||
- apt-get update && apt-get install -y libidn11-dev
|
- .poezio-tests
|
||||||
- git clone https://lab.louiz.org/poezio/slixmpp.git
|
|
||||||
- pip3 install pytest pyasn1-modules cffi --upgrade
|
|
||||||
- cd slixmpp
|
|
||||||
- python3 setup.py install
|
|
||||||
- cd ..
|
|
||||||
- python3 setup.py install
|
|
||||||
- py.test -v test/
|
|
||||||
|
|
||||||
pytest-3.9:
|
pytest-3.9:
|
||||||
stage: test
|
stage: test
|
||||||
image: python:3.9
|
image: python:3.9
|
||||||
script:
|
extends:
|
||||||
- apt-get update && apt-get install -y libidn11-dev
|
- .poezio-tests
|
||||||
- git clone https://lab.louiz.org/poezio/slixmpp.git
|
|
||||||
- pip3 install pytest pyasn1-modules cffi --upgrade
|
|
||||||
- cd slixmpp
|
|
||||||
- python3 setup.py install
|
|
||||||
- cd ..
|
|
||||||
- python3 setup.py install
|
|
||||||
- py.test -v test/
|
|
||||||
|
|
||||||
pytest-3.10:
|
pytest-3.10:
|
||||||
stage: test
|
stage: test
|
||||||
image: python:3.10-rc
|
image: python:3.10-rc
|
||||||
script:
|
extends:
|
||||||
- apt-get update && apt-get install -y libidn11-dev
|
- .poezio-tests
|
||||||
- git clone https://lab.louiz.org/poezio/slixmpp.git
|
|
||||||
- pip3 install pytest pyasn1-modules cffi --upgrade
|
|
||||||
- cd slixmpp
|
|
||||||
- python3 setup.py install
|
|
||||||
- cd ..
|
|
||||||
- python3 setup.py install
|
|
||||||
- py.test -v test/
|
|
||||||
|
|
||||||
pylint-plugins:
|
pylint-plugins:
|
||||||
stage: lint
|
stage: lint
|
||||||
|
@ -96,7 +85,13 @@ pylint-plugins:
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
script:
|
script:
|
||||||
- apt-get update && apt-get install -y libidn11-dev
|
- apt-get update && apt-get install -y libidn11-dev
|
||||||
- pip3 install pylint pyasn1-modules cffi --upgrade
|
- wget https://static.rust-lang.org/rustup/archive/1.14.0/x86_64-unknown-linux-gnu/rustup-init
|
||||||
|
- chmod +x rustup-init
|
||||||
|
- ./rustup-init -y --no-modify-path --default-toolchain nightly
|
||||||
|
- rm rustup-init
|
||||||
|
- ls ~/.cargo/bin
|
||||||
|
- export PATH=$PATH:$HOME/.cargo/bin
|
||||||
|
- pip3 install pylint pyasn1-modules cffi setuptools-rust --upgrade
|
||||||
- pip3 install -e git+https://lab.louiz.org/poezio/slixmpp.git#egg=slixmpp
|
- pip3 install -e git+https://lab.louiz.org/poezio/slixmpp.git#egg=slixmpp
|
||||||
- pip3 install -r requirements-plugins.txt
|
- pip3 install -r requirements-plugins.txt
|
||||||
- python3 setup.py install
|
- python3 setup.py install
|
||||||
|
|
13
Cargo.toml
Normal file
13
Cargo.toml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
[package]
|
||||||
|
name = "poezio"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = [
|
||||||
|
"Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>",
|
||||||
|
"Maxime “pep” Buquet <pep@bouah.net>",
|
||||||
|
]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
cpython = "0.7"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
crate-type = ["cdylib"]
|
|
@ -1,5 +1,7 @@
|
||||||
recursive-include doc/source *
|
recursive-include doc/source *
|
||||||
recursive-include tools
|
recursive-include tools
|
||||||
|
recursive-include src *
|
||||||
|
include Cargo.toml
|
||||||
include data/poezio.1
|
include data/poezio.1
|
||||||
include data/io.poez.Poezio.appdata.xml
|
include data/io.poez.Poezio.appdata.xml
|
||||||
include data/io.poez.Poezio.desktop
|
include data/io.poez.Poezio.desktop
|
||||||
|
|
|
@ -5,3 +5,4 @@ pycares==2.3.0
|
||||||
pyasn1==0.4.2
|
pyasn1==0.4.2
|
||||||
pyasn1-modules==0.2.1
|
pyasn1-modules==0.2.1
|
||||||
typing_extensions
|
typing_extensions
|
||||||
|
setuptools-rust==1.1.2
|
||||||
|
|
17
setup.py
17
setup.py
|
@ -10,6 +10,12 @@ except ImportError:
|
||||||
print('\nSetuptools was not found. Install setuptools for python 3.\n')
|
print('\nSetuptools was not found. Install setuptools for python 3.\n')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
try:
|
||||||
|
from setuptools_rust import Binding, RustExtension
|
||||||
|
except ImportError:
|
||||||
|
print('\nsetuptools-rust was not found. Install setuptools-rust for python 3.\n')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
cmdclass = {}
|
cmdclass = {}
|
||||||
try:
|
try:
|
||||||
from sphinx.setup_command import BuildDoc
|
from sphinx.setup_command import BuildDoc
|
||||||
|
@ -124,6 +130,7 @@ setup(
|
||||||
description="A console XMPP client",
|
description="A console XMPP client",
|
||||||
long_description=LONG_DESCRIPTION,
|
long_description=LONG_DESCRIPTION,
|
||||||
ext_modules=[module_poopt],
|
ext_modules=[module_poopt],
|
||||||
|
rust_extensions=[RustExtension('poezio.libpoezio', binding=Binding.RustCPython)],
|
||||||
url='https://poez.io/',
|
url='https://poez.io/',
|
||||||
license='GPL-3.0-or-later',
|
license='GPL-3.0-or-later',
|
||||||
download_url='https://dev.louiz.org/projects/poezio/files',
|
download_url='https://dev.louiz.org/projects/poezio/files',
|
||||||
|
@ -165,7 +172,15 @@ setup(
|
||||||
+ find_doc('share/doc/poezio/html', 'build/html')
|
+ find_doc('share/doc/poezio/html', 'build/html')
|
||||||
+ sphinx_files_found
|
+ sphinx_files_found
|
||||||
),
|
),
|
||||||
install_requires=['slixmpp>=1.6.0', 'aiodns', 'pyasn1_modules', 'pyasn1', 'typing_extensions', 'setuptools'],
|
install_requires=[
|
||||||
|
'slixmpp>=1.8.2',
|
||||||
|
'aiodns',
|
||||||
|
'pyasn1_modules',
|
||||||
|
'pyasn1',
|
||||||
|
'typing_extensions',
|
||||||
|
'setuptools',
|
||||||
|
'setuptools-rust',
|
||||||
|
],
|
||||||
extras_require={'OTR plugin': 'python-potr>=1.0',
|
extras_require={'OTR plugin': 'python-potr>=1.0',
|
||||||
'Screen autoaway plugin': 'pyinotify==0.9.4',
|
'Screen autoaway plugin': 'pyinotify==0.9.4',
|
||||||
'Avoiding cython': 'cffi'},
|
'Avoiding cython': 'cffi'},
|
||||||
|
|
6
src/lib.rs
Normal file
6
src/lib.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#[macro_use]
|
||||||
|
extern crate cpython;
|
||||||
|
|
||||||
|
py_module_initializer!(libpoezio, initlibpoezio, PyInit_libpoezio, |py, m| {
|
||||||
|
Ok(())
|
||||||
|
});
|
Loading…
Reference in a new issue