summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml59
-rw-r--r--Cargo.toml13
-rw-r--r--MANIFEST.in2
-rw-r--r--requirements.txt1
-rwxr-xr-xsetup.py17
-rw-r--r--src/lib.rs6
6 files changed, 65 insertions, 33 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a908b86a..73130a2e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -38,57 +38,46 @@ security-check:
- pip3 install safety
- safety check -r requirements.txt
-pytest-3.7:
- stage: test
- image: python:3.7
+.poezio-tests:
script:
- 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
- - pip3 install pytest pyasn1-modules cffi --upgrade
+ - pip3 install pytest pyasn1-modules cffi setuptools-rust --upgrade
- cd slixmpp
- python3 setup.py install
- cd ..
- python3 setup.py install
- py.test -v test/
+pytest-3.7:
+ stage: test
+ image: python:3.7
+ extends:
+ - .poezio-tests
+
pytest-3.8:
stage: test
image: python:3.8
- script:
- - apt-get update && apt-get install -y libidn11-dev
- - 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/
+ extends:
+ - .poezio-tests
pytest-3.9:
stage: test
image: python:3.9
- script:
- - apt-get update && apt-get install -y libidn11-dev
- - 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/
+ extends:
+ - .poezio-tests
pytest-3.10:
stage: test
image: python:3.10-rc
- script:
- - apt-get update && apt-get install -y libidn11-dev
- - 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/
+ extends:
+ - .poezio-tests
pylint-plugins:
stage: lint
@@ -96,7 +85,13 @@ pylint-plugins:
allow_failure: true
script:
- 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 -r requirements-plugins.txt
- python3 setup.py install
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 00000000..3beed930
--- /dev/null
+++ b/Cargo.toml
@@ -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"]
diff --git a/MANIFEST.in b/MANIFEST.in
index 6f4000db..8ea8884b 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,5 +1,7 @@
recursive-include doc/source *
recursive-include tools
+recursive-include src *
+include Cargo.toml
include data/poezio.1
include data/io.poez.Poezio.appdata.xml
include data/io.poez.Poezio.desktop
diff --git a/requirements.txt b/requirements.txt
index 403cc355..6194294d 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,3 +5,4 @@ pycares==2.3.0
pyasn1==0.4.2
pyasn1-modules==0.2.1
typing_extensions
+setuptools-rust==1.1.2
diff --git a/setup.py b/setup.py
index 8c9fa723..4c568c38 100755
--- a/setup.py
+++ b/setup.py
@@ -10,6 +10,12 @@ except ImportError:
print('\nSetuptools was not found. Install setuptools for python 3.\n')
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 = {}
try:
from sphinx.setup_command import BuildDoc
@@ -124,6 +130,7 @@ setup(
description="A console XMPP client",
long_description=LONG_DESCRIPTION,
ext_modules=[module_poopt],
+ rust_extensions=[RustExtension('poezio.libpoezio', binding=Binding.RustCPython)],
url='https://poez.io/',
license='GPL-3.0-or-later',
download_url='https://dev.louiz.org/projects/poezio/files',
@@ -165,7 +172,15 @@ setup(
+ find_doc('share/doc/poezio/html', 'build/html')
+ 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',
'Screen autoaway plugin': 'pyinotify==0.9.4',
'Avoiding cython': 'cffi'},
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
index 00000000..d261b89e
--- /dev/null
+++ b/src/lib.rs
@@ -0,0 +1,6 @@
+#[macro_use]
+extern crate cpython;
+
+py_module_initializer!(libpoezio, initlibpoezio, PyInit_libpoezio, |py, m| {
+ Ok(())
+});