Compare commits

..

2 Commits

Author SHA1 Message Date
B. Petersen
af20b14077 change oder of typedefs, function-definitions and defines
as c is top-down, we start with the typedefs
so that functions can use them freely.
after that, the functions are declared
and finally the #defines (for less noise in the function sections).
grouping is done by classes.
2019-09-19 12:04:16 +02:00
B. Petersen
d338748115 add missing doxygen commands, fix typo 2019-09-19 11:41:27 +02:00
7 changed files with 220 additions and 149 deletions

View File

@@ -12,7 +12,7 @@ restore-workspace: &restore-workspace
restore-cache: &restore-cache restore-cache: &restore-cache
restore_cache: restore_cache:
keys: keys:
- cargo-v2-{{ checksum "rust-toolchain" }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}-{{ arch }} - cargo-v1-{{ checksum "rust-toolchain" }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}-{{ arch }}
- repo-source-{{ .Branch }}-{{ .Revision }} - repo-source-{{ .Branch }}-{{ .Revision }}
commands: commands:
@@ -23,9 +23,20 @@ commands:
steps: steps:
- *restore-workspace - *restore-workspace
- *restore-cache - *restore-cache
- setup_remote_docker:
docker_layer_caching: true
# TODO: move into image
- run:
name: Install Docker client
command: |
set -x
VER="18.09.2"
curl -L -o /tmp/docker-$VER.tgz https://download.docker.com/linux/static/stable/x86_64/docker-$VER.tgz
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
mv /tmp/docker/* /usr/bin
- run: - run:
name: Test (<< parameters.target >>) name: Test (<< parameters.target >>)
command: TARGET=<< parameters.target >> ci_scripts/run-rust-test.sh command: TARGET=<< parameters.target >> ci/run.sh
no_output_timeout: 15m no_output_timeout: 15m
jobs: jobs:
@@ -41,7 +52,7 @@ jobs:
command: cargo generate-lockfile command: cargo generate-lockfile
- restore_cache: - restore_cache:
keys: keys:
- cargo-v2-{{ checksum "rust-toolchain" }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}-{{ arch }} - cargo-v1-{{ checksum "rust-toolchain" }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}-{{ arch }}
- run: rustup install $(cat rust-toolchain) - run: rustup install $(cat rust-toolchain)
- run: rustup default $(cat rust-toolchain) - run: rustup default $(cat rust-toolchain)
- run: rustup component add --toolchain $(cat rust-toolchain) rustfmt - run: rustup component add --toolchain $(cat rust-toolchain) rustfmt
@@ -50,14 +61,13 @@ jobs:
- run: cargo fetch - run: cargo fetch
- run: rustc +stable --version - run: rustc +stable --version
- run: rustc +$(cat rust-toolchain) --version - run: rustc +$(cat rust-toolchain) --version
# make sure this git repo doesn't grow too big - run: rm -rf .git
- run: git gc
- persist_to_workspace: - persist_to_workspace:
root: /mnt root: /mnt
paths: paths:
- crate - crate
- save_cache: - save_cache:
key: cargo-v2-{{ checksum "rust-toolchain" }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}-{{ arch }} key: cargo-v1-{{ checksum "rust-toolchain" }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}-{{ arch }}
paths: paths:
- "~/.cargo" - "~/.cargo"
- "~/.rustup" - "~/.rustup"
@@ -92,7 +102,7 @@ jobs:
- run: cargo fetch - run: cargo fetch
- run: - run:
name: Test name: Test
command: TARGET=x86_64-apple-darwin ci_scripts/run-rust-test.sh command: TARGET=x86_64-apple-darwin ci/run.sh
test_x86_64-unknown-linux-gnu: test_x86_64-unknown-linux-gnu:
executor: default executor: default
@@ -114,18 +124,18 @@ jobs:
build_test_docs_wheel: build_test_docs_wheel:
docker: machine: True
- image: deltachat/coredeps
environment:
TESTS: 1
DOCS: 1
working_directory: /mnt/crate
steps: steps:
- *restore-workspace - checkout
- *restore-cache # - run: docker pull deltachat/doxygen
- run: docker pull deltachat/coredeps
- run: - run:
name: build docs, run tests and build wheels name: build docs, run tests and build wheels
command: ci_scripts/run-python.sh command: ci_scripts/ci_run.sh
environment:
TESTS: 1
DOCS: 1
- run: - run:
name: copying docs and wheels to workspace name: copying docs and wheels to workspace
command: | command: |
@@ -133,6 +143,7 @@ jobs:
# cp -av docs workspace/c-docs # cp -av docs workspace/c-docs
cp -av python/.docker-tox/wheelhouse workspace/ cp -av python/.docker-tox/wheelhouse workspace/
cp -av python/doc/_build/ workspace/py-docs cp -av python/doc/_build/ workspace/py-docs
- persist_to_workspace: - persist_to_workspace:
root: workspace root: workspace
paths: paths:
@@ -165,16 +176,15 @@ workflows:
test: test:
jobs: jobs:
- cargo_fetch - build_test_docs_wheel
- build_test_docs_wheel:
requires:
- cargo_fetch
- upload_docs_wheels: - upload_docs_wheels:
requires: requires:
- build_test_docs_wheel - build_test_docs_wheel
- cargo_fetch
- rustfmt: - rustfmt:
requires: requires:
- cargo_fetch - cargo_fetch
- clippy: - clippy:
requires: requires:
- cargo_fetch - cargo_fetch

View File

@@ -39,4 +39,8 @@ fi
# Run all the test configurations: # Run all the test configurations:
$CARGO_CMD $CARGO_SUBCMD $OPT $CARGO_CMD $CARGO_SUBCMD $OPT
$CARGO_CMD $CARGO_SUBCMD $OPT_RELEASE
$CARGO_CMD $CARGO_SUBCMD $OPT_RELEASE_IGNORED $CARGO_CMD $CARGO_SUBCMD $OPT_RELEASE_IGNORED
# Build the ffi lib
$CARGO_CMD $CARGO_SUBCMD $OPT_FFI_RELEASE

22
ci_scripts/ci_run.sh Executable file
View File

@@ -0,0 +1,22 @@
# perform CI jobs on PRs and after merges to master.
# triggered from .circleci/config.yml
set -e -x
export BRANCH=${CIRCLE_BRANCH:-test7}
# run doxygen on c-source (needed by later doc-generation steps).
# XXX modifies the host filesystem docs/xml and docs/html directories
# XXX which you can then only remove with sudo as they belong to root
# XXX we don't do doxygen doc generation with Rust anymore, needs to be
# substituted with rust-docs
#if [ -n "$DOCS" ] ; then
# docker run --rm -it -v $PWD:/mnt -w /mnt/docs deltachat/doxygen doxygen
#fi
# run everything else inside docker (TESTS, DOCS, WHEELS)
docker run -e DCC_PY_LIVECONFIG -e BRANCH -e TESTS -e DOCS \
--rm -it -v $(pwd):/mnt -w /mnt \
deltachat/coredeps ci_scripts/run_all.sh

View File

@@ -36,21 +36,20 @@ if [ -n "$TESTS" ]; then
rm -rf src/deltachat/__pycache__ rm -rf src/deltachat/__pycache__
export PYTHONDONTWRITEBYTECODE=1 export PYTHONDONTWRITEBYTECODE=1
# run tox. The circle-ci project env-var-setting DCC_PY_LIVECONFIG # run tox
# allows running of "liveconfig" tests but for speed reasons # XXX we don't run liveconfig tests because they hang sometimes
# we run them only for the highest python version we support # see https://github.com/deltachat/deltachat-core-rust/issues/331
# unset DCC_PY_LIVECONFIG
tox --workdir "$TOXWORKDIR" -e py37 tox --workdir "$TOXWORKDIR" -e lint,py35,py36,py37,auditwheels -- -k "not qr"
unset DCC_PY_LIVECONFIG tox --workdir "$TOXWORKDIR" -e py35,py36,py37 -- -k "qr"
tox --workdir "$TOXWORKDIR" -p4 -e lint,py35,py36,doc
tox --workdir "$TOXWORKDIR" -e auditwheels
popd popd
fi fi
# if [ -n "$DOCS" ]; then if [ -n "$DOCS" ]; then
# echo ----------------------- echo -----------------------
# echo generating python docs echo generating python docs
# echo ----------------------- echo -----------------------
# (cd python && tox --workdir "$TOXWORKDIR" -e doc) (cd python && tox --workdir "$TOXWORKDIR" -e doc)
# fi fi

View File

@@ -11,6 +11,16 @@ extern "C" {
#endif #endif
typedef struct _dc_context dc_context_t;
typedef struct _dc_array dc_array_t;
typedef struct _dc_chatlist dc_chatlist_t;
typedef struct _dc_chat dc_chat_t;
typedef struct _dc_msg dc_msg_t;
typedef struct _dc_contact dc_contact_t;
typedef struct _dc_lot dc_lot_t;
typedef struct _dc_provider dc_provider_t;
/** /**
* @mainpage Getting started * @mainpage Getting started
* *
@@ -189,13 +199,6 @@ extern "C" {
* SQLite database for offline functionality and for account-related * SQLite database for offline functionality and for account-related
* settings. * settings.
*/ */
typedef struct _dc_context dc_context_t;
typedef struct _dc_array dc_array_t;
typedef struct _dc_chatlist dc_chatlist_t;
typedef struct _dc_chat dc_chat_t;
typedef struct _dc_msg dc_msg_t;
typedef struct _dc_contact dc_contact_t;
typedef struct _dc_lot dc_lot_t;
/** /**
@@ -442,112 +445,6 @@ char* dc_get_info (dc_context_t* context);
*/ */
char* dc_get_oauth2_url (dc_context_t* context, const char* addr, const char* redirect_uri); char* dc_get_oauth2_url (dc_context_t* context, const char* addr, const char* redirect_uri);
/**
* Opaque object containing information about one single email provider.
*/
typedef struct _dc_provider dc_provider_t;
/**
* Create a provider struct for the given domain.
*
* @param doamin The domain to get provider info for.
* @return a dc_provider_t struct which can be used with the dc_provider_get_*
* accessor functions. If no provider info is found, NULL will be
* returned.
*/
dc_provider_t* dc_provider_new_from_domain (char* domain);
/**
* Create a provider struct for the given email address.
*
* The provider is extracted from the email address and it's information is returned.
*
* @param email The user's email address to extract the provider info form.
* @return a dc_provider_t struct which can be used with the dc_provider_get_*
* accessor functions. If no provider info is found, NULL will be
* returned.
*/
dc_provider_t* dc_provider_new_from_email (char* email);
/**
* URL of the overview page.
*
* This URL allows linking to the providers page on providers.delta.chat.
*
* @param provider The dc_provider_t struct.
* @return A string which must be free()d.
*/
char* dc_provider_get_overview_page (const dc_provider_t* provider);
/**
* The provider's name.
*
* The name of the provider, e.g. "POSTEO".
*
* @param provider The dc_provider_t struct.
* @return A string which must be free()d.
*/
char* dc_provider_get_name (const dc_provider_t* provider);
/**
* The markdown content of the providers page.
*
* This contains the preparation steps or additional information if the status
* is DC_PROVIDER_STATUS_BROKEN.
*
* @param provider The dc_provider_t struct.
* @return A string which must be free()d.
*/
char* dc_provider_get_markdown (const dc_provider_t* provider);
/**
* Date of when the state was last checked/updated.
*
* This is returned as a string.
*
* @param provider The dc_provider_t struct.
* @return A string which must be free()d.
*/
char* dc_provider_get_status_date (const dc_provider_t* provider);
/**
* Whether DC works with this provider.
*
* Can be one of @ref DC_PROVIDER_STATUS_OK, @ref
* DC_PROVIDER_STATUS_PREPARATION and @ref DC_PROVIDER_STATUS_BROKEN.
*
* @param provider The dc_provider_t struct.
* @return The status as a constant number.
*/
int dc_provider_get_status (const dc_provider_t* provider);
/**
* Free the provider info struct.
*
* @param provider The dc_provider_t struct.
*/
void dc_provider_unref (const dc_provider_t* provider);
/**
* Provider status returned by dc_provider_get_status().
*
* Works right out of the box without any preperation steps needed
*/
#define DC_PROVIDER_STATUS_OK 1
/**
* Provider status returned by dc_provider_get_status().
*
* Works, but preparation steps are needed
*/
#define DC_PROVIDER_STATUS_PREPARATION 2
/**
* Provider status returned by dc_provider_get_status().
*
* Doesn't work (too unstable to use falls also in this category)
*/
#define DC_PROVIDER_STATUS_BROKEN 3
// connect // connect
@@ -3524,6 +3421,110 @@ int dc_contact_is_blocked (const dc_contact_t* contact);
int dc_contact_is_verified (dc_contact_t* contact); int dc_contact_is_verified (dc_contact_t* contact);
/**
* @class dc_provider_t
*
* Opaque object containing information about one single email provider.
*/
/**
* Create a provider struct for the given domain.
*
* @memberof dc_provider_t
* @param domain The domain to get provider info for.
* @return a dc_provider_t struct which can be used with the dc_provider_get_*
* accessor functions. If no provider info is found, NULL will be
* returned.
*/
dc_provider_t* dc_provider_new_from_domain (char* domain);
/**
* Create a provider struct for the given email address.
*
* The provider is extracted from the email address and it's information is returned.
*
* @memberof dc_provider_t
* @param email The user's email address to extract the provider info form.
* @return a dc_provider_t struct which can be used with the dc_provider_get_*
* accessor functions. If no provider info is found, NULL will be
* returned.
*/
dc_provider_t* dc_provider_new_from_email (char* email);
/**
* URL of the overview page.
*
* This URL allows linking to the providers page on providers.delta.chat.
*
* @memberof dc_provider_t
* @param provider The dc_provider_t struct.
* @return A string which must be free()d.
*/
char* dc_provider_get_overview_page (const dc_provider_t* provider);
/**
* The provider's name.
*
* The name of the provider, e.g. "POSTEO".
*
* @memberof dc_provider_t
* @param provider The dc_provider_t struct.
* @return A string which must be free()d.
*/
char* dc_provider_get_name (const dc_provider_t* provider);
/**
* The markdown content of the providers page.
*
* This contains the preparation steps or additional information if the status
* is @ref DC_PROVIDER_STATUS_BROKEN.
*
* @memberof dc_provider_t
* @param provider The dc_provider_t struct.
* @return A string which must be free()d.
*/
char* dc_provider_get_markdown (const dc_provider_t* provider);
/**
* Date of when the state was last checked/updated.
*
* This is returned as a string.
*
* @memberof dc_provider_t
* @param provider The dc_provider_t struct.
* @return A string which must be free()d.
*/
char* dc_provider_get_status_date (const dc_provider_t* provider);
/**
* Whether DC works with this provider.
*
* Can be one of @ref DC_PROVIDER_STATUS_OK, @ref
* DC_PROVIDER_STATUS_PREPARATION and @ref DC_PROVIDER_STATUS_BROKEN.
*
* @memberof dc_provider_t
* @param provider The dc_provider_t struct.
* @return The status as a constant number.
*/
int dc_provider_get_status (const dc_provider_t* provider);
/**
* Free the provider info struct.
*
* @memberof dc_provider_t
* @param provider The dc_provider_t struct.
*/
void dc_provider_unref (const dc_provider_t* provider);
/** /**
* @class dc_lot_t * @class dc_lot_t
* *
@@ -4131,6 +4132,41 @@ void dc_array_add_id (dc_array_t*, uint32_t); // depreca
#define DC_SHOW_EMAILS_ALL 2 #define DC_SHOW_EMAILS_ALL 2
/**
* @defgroup DC_PROVIDER_STATUS DC_PROVIDER_STATUS
*
* These constants are used as return values for dc_provider_get_status().
*
* @addtogroup DC_PROVIDER_STATUS
* @{
*/
/**
* Provider status returned by dc_provider_get_status().
*
* Works right out of the box without any preperation steps needed
*/
#define DC_PROVIDER_STATUS_OK 1
/**
* Provider status returned by dc_provider_get_status().
*
* Works, but preparation steps are needed
*/
#define DC_PROVIDER_STATUS_PREPARATION 2
/**
* Provider status returned by dc_provider_get_status().
*
* Doesn't work (too unstable to use falls also in this category)
*/
#define DC_PROVIDER_STATUS_BROKEN 3
/**
* @}
*/
/* /*
* TODO: Strings need some doumentation about used placeholders. * TODO: Strings need some doumentation about used placeholders.
* *

View File

@@ -4,7 +4,7 @@ from deltachat import const
from conftest import wait_configuration_progress, wait_msgs_changed from conftest import wait_configuration_progress, wait_msgs_changed
class TestOnlineInCreation: class TestInCreation:
def test_forward_increation(self, acfactory, data, lp): def test_forward_increation(self, acfactory, data, lp):
ac1 = acfactory.get_online_configuring_account() ac1 = acfactory.get_online_configuring_account()
ac2 = acfactory.get_online_configuring_account() ac2 = acfactory.get_online_configuring_account()

View File

@@ -19,12 +19,12 @@ deps =
pytest-rerunfailures pytest-rerunfailures
pytest-timeout pytest-timeout
pytest-xdist pytest-xdist
auditwheel
pdbpp pdbpp
requests requests
[testenv:auditwheels] [testenv:auditwheels]
skipsdist = True skipsdist = True
deps = auditwheel
commands = commands =
python tests/auditwheels.py {toxworkdir}/wheelhouse python tests/auditwheels.py {toxworkdir}/wheelhouse
@@ -45,7 +45,7 @@ commands =
[testenv:doc] [testenv:doc]
basepython = python3.5 basepython = python3.5
deps = deps =
sphinx==2.2.0 sphinx==2.0.1
breathe breathe
changedir = doc changedir = doc