From c1d2467f223f68d90fc7f5b3b41881f1c49573a2 Mon Sep 17 00:00:00 2001
From: Nico Alt <nicoalt@posteo.org>
Date: Mon, 16 Dec 2019 18:50:49 +0100
Subject: [PATCH] Set up flit for briar-wrapper

Closes
https://code.briarproject.org/briar/python-briar-wrapper/issues/2.
---
 .gitignore                                    |  1 +
 meson.build => briar_wrapper/__init__.py      |  8 ++---
 {src/briar/api => briar_wrapper}/api.py       |  0
 {src/briar/api => briar_wrapper}/constants.py |  0
 {src/briar/api => briar_wrapper}/model.py     |  0
 .../api => briar_wrapper}/models/contacts.py  |  0
 .../models/private_chat.py                    |  0
 .../models/socket_listener.py                 |  0
 pyproject.toml                                | 31 +++++++++++++++++++
 src/meson.build                               | 15 ---------
 10 files changed, 34 insertions(+), 21 deletions(-)
 rename meson.build => briar_wrapper/__init__.py (52%)
 rename {src/briar/api => briar_wrapper}/api.py (100%)
 rename {src/briar/api => briar_wrapper}/constants.py (100%)
 rename {src/briar/api => briar_wrapper}/model.py (100%)
 rename {src/briar/api => briar_wrapper}/models/contacts.py (100%)
 rename {src/briar/api => briar_wrapper}/models/private_chat.py (100%)
 rename {src/briar/api => briar_wrapper}/models/socket_listener.py (100%)
 create mode 100644 pyproject.toml
 delete mode 100644 src/meson.build

diff --git a/.gitignore b/.gitignore
index 7a7e68f..9163101 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 .coverage
 __pycache__
+dist
diff --git a/meson.build b/briar_wrapper/__init__.py
similarity index 52%
rename from meson.build
rename to briar_wrapper/__init__.py
index e8f8a28..5880209 100644
--- a/meson.build
+++ b/briar_wrapper/__init__.py
@@ -2,10 +2,6 @@
 # SPDX-License-Identifier: AGPL-3.0-only
 # License-Filename: LICENSE.md
 
-project(
-  'briar-wrapper',
-  version: '0.1.0',
-  meson_version: '>= 0.50.0',
-)
+"""briar wrapper for briar:headless"""
 
-subdir('src')
+__version__ = "0.0.1"
diff --git a/src/briar/api/api.py b/briar_wrapper/api.py
similarity index 100%
rename from src/briar/api/api.py
rename to briar_wrapper/api.py
diff --git a/src/briar/api/constants.py b/briar_wrapper/constants.py
similarity index 100%
rename from src/briar/api/constants.py
rename to briar_wrapper/constants.py
diff --git a/src/briar/api/model.py b/briar_wrapper/model.py
similarity index 100%
rename from src/briar/api/model.py
rename to briar_wrapper/model.py
diff --git a/src/briar/api/models/contacts.py b/briar_wrapper/models/contacts.py
similarity index 100%
rename from src/briar/api/models/contacts.py
rename to briar_wrapper/models/contacts.py
diff --git a/src/briar/api/models/private_chat.py b/briar_wrapper/models/private_chat.py
similarity index 100%
rename from src/briar/api/models/private_chat.py
rename to briar_wrapper/models/private_chat.py
diff --git a/src/briar/api/models/socket_listener.py b/briar_wrapper/models/socket_listener.py
similarity index 100%
rename from src/briar/api/models/socket_listener.py
rename to briar_wrapper/models/socket_listener.py
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..4b0a981
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,31 @@
+[build-system]
+requires = ["flit"]
+build-backend = "flit.buildapi"
+
+[tool.flit.metadata]
+module = "briar_wrapper"
+author = "Briar Community"
+author-email = "contact@briarproject.org"
+home-page = "https://code.briarproject.org/briar/python-briar-wrapper"
+requires = [
+	"requests2>=2.16.0",
+	"websockets>=8.0.2",
+]
+requires-python=">=3"
+dist-name="briar-wrapper"
+description-file="README.md"
+keywords="Briar,p2p,Tor,Java,Kotlin"
+classifiers = [
+	"Development Status :: 3 - Alpha",
+	"Intended Audience :: Developers",
+	"License :: OSI Approved :: GNU Affero General Public License v3",
+	"Natural Language :: English",
+	"Operating System :: OS Independent",
+	"Programming Language :: Java",
+	"Programming Language :: Python :: 3",
+	"Topic :: Communications :: Chat",
+]
+
+[tool.flit.metadata.urls]
+"Bug Tracker" = "https://code.briarproject.org/briar/python-briar-wrapper/issues/"
+"Briar REST API" = "https://code.briarproject.org/briar/briar/blob/master/briar-headless/README.md"
diff --git a/src/meson.build b/src/meson.build
deleted file mode 100644
index a85b92f..0000000
--- a/src/meson.build
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (c) 2019 Nico Alt
-# SPDX-License-Identifier: AGPL-3.0-only
-# License-Filename: LICENSE.md
-
-PACKAGE_DATA_DIR = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
-MODULE_DIR = join_paths(PACKAGE_DATA_DIR, 'briar')
-
-python3 = import('python3')
-
-conf = configuration_data()
-conf.set('PYTHON', python3.find_python().path())
-conf.set('VERSION', meson.project_version())
-conf.set('PACKAGE_DATA_DIR', PACKAGE_DATA_DIR)
-
-install_subdir('briar/api', install_dir: MODULE_DIR)
-- 
GitLab