diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-10-17 05:12:21 +0200 |
---|---|---|
committer | Maxime “pep” Buquet <pep@bouah.net> | 2022-08-21 17:19:58 +0200 |
commit | f8b4ef76980e1daac46e00f94941de50c0debbb6 (patch) | |
tree | 6b34586c90c16948f079f97dc5fde7911d6aba5c | |
parent | c0d5d7ab0d33608a718d0262f4d806306226c5ea (diff) | |
download | poezio-f8b4ef76980e1daac46e00f94941de50c0debbb6.tar.gz poezio-f8b4ef76980e1daac46e00f94941de50c0debbb6.tar.bz2 poezio-f8b4ef76980e1daac46e00f94941de50c0debbb6.tar.xz poezio-f8b4ef76980e1daac46e00f94941de50c0debbb6.zip |
Add a Rust project.
-rw-r--r-- | .gitlab-ci.yml | 59 | ||||
-rw-r--r-- | Cargo.toml | 13 | ||||
-rw-r--r-- | MANIFEST.in | 2 | ||||
-rw-r--r-- | requirements.txt | 1 | ||||
-rwxr-xr-x | setup.py | 17 | ||||
-rw-r--r-- | src/lib.rs | 6 |
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 @@ -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(()) +}); |