Skip to content
This repository was archived by the owner on Sep 26, 2022. It is now read-only.

Commit 4f2ad7c

Browse files
committed
Improves the install script so the client can be installed alongside the rest
1 parent 06e562c commit 4f2ad7c

File tree

7 files changed

+41
-117
lines changed

7 files changed

+41
-117
lines changed

CONTRIBUTING.md

+7
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,10 @@ We use [pytest](https://docs.pytest.org/en/latest/) to build and run tests. Test
104104

105105
We require that all commits to be merge into master are signed. You can enable commit signing on GitHub by following [Signing commits](https://help.github.com/en/github/authenticating-to-github/signing-commits).
106106

107+
## Installing the development client
108+
109+
You can install the development client for easier testing by setting the development flag (DEV=1) when installing `teos`.
110+
111+
```
112+
DEV=1 python setup.py install
113+
```

common/setup.py

-47
This file was deleted.

contrib/client/INSTALL.md

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
# Install
22

3-
`teos-client` has some dependencies that can be satisfied by following [DEPENDENCIES.md](DEPENDENCIES.md). If your system already satisfies the dependencies, you can skip that part.
4-
5-
Once the dependencies are satisfied, `teos-client` can be installed from source by running:
3+
`teos-client` gets installed alongside `teos` as long as you set the development flag when installing `teos`:
64

75
```
8-
python setup.py install
6+
DEV=1 python setup.py install
97
```
108

11-
`teos-client` will be available in the shell once the installation is completed.
12-
13-
## Modify configuration parameters
14-
If you'd like to modify some of the configuration defaults (such as the user directory, where the logs and appointment receipts will be stored) you can do so in the config file located at:
9+
You can also get a standalone client from pip:
1510

16-
<data_dir>/.teos_client/teos_client.conf
17-
18-
`<data_dir>` defaults to your home directory (`~`).
11+
```
12+
pip install teos-client
13+
```

contrib/client/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
cryptography
1+
cryptography>=2.8
22
requests
33
structlog

contrib/client/setup.py

-50
This file was deleted.

contrib/client/teos_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from common.config_loader import ConfigLoader
2020
from common.cryptographer import Cryptographer
2121
from common.tools import setup_data_folder
22-
from common.exceptions import BasicException, InvalidKey, InvalidParameter, SignatureError, TowerResponseError
22+
from common.exceptions import BasicException, InvalidKey, InvalidParameter, TowerResponseError
2323
from common.tools import is_256b_hex_str, is_locator, compute_locator, is_compressed_pk
2424

2525
from contrib.client import DEFAULT_CONF, DATA_DIR, CONF_FILE_NAME

setup.py

+26-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import glob
23
import shutil
34
import setuptools
45

@@ -10,15 +11,17 @@
1011
with open("requirements.txt") as f:
1112
requirements = [r for r in f.read().split("\n") if len(r)]
1213

14+
# Remove undesired files
15+
wildcards = ["**/__pycache__", "**/.DS_Store"]
16+
for entry in wildcards:
17+
for file_dir in glob.glob(entry, recursive=True):
18+
if os.path.isdir(file_dir):
19+
shutil.rmtree(file_dir)
20+
elif os.path.isfile(file_dir):
21+
os.remove(file_dir)
1322

1423
PACKAGES = ["common", "teos", "teos.cli", "teos.protobuf", "teos.utils"]
1524

16-
# Remove undesired files
17-
for package in PACKAGES:
18-
if os.path.exists(f"{package}/__pycache__"):
19-
shutil.rmtree(f"{package}/__pycache__")
20-
if os.path.exists(f"{package}/.DS_Store"):
21-
os.remove(f"{package}/.DS_Store")
2225

2326
CLASSIFIERS = [
2427
"Programming Language :: Python",
@@ -33,6 +36,22 @@
3336
"Topic :: Software Development :: Libraries :: Python Modules",
3437
]
3538

39+
CONSOLE_SCRIPTS = ["teosd=teos.teosd:run", "teos-cli=teos.cli.teos_cli:run"]
40+
41+
# Add additional scripts if DEV=1
42+
if os.getenv("DEV", False):
43+
# Add missing requirements
44+
with open("contrib/client/requirements.txt") as f:
45+
requirements_client = [r for r in f.read().split("\n") if len(r)]
46+
47+
requirements = list(set(requirements).union(requirements_client))
48+
49+
# Extend packages
50+
PACKAGES.extend(["contrib", "contrib.client"])
51+
52+
# Add console scripts
53+
CONSOLE_SCRIPTS.append("teos-client=contrib.client.teos_client:run")
54+
3655
setuptools.setup(
3756
name="teos",
3857
version=__version__,
@@ -46,5 +65,5 @@
4665
classifiers=CLASSIFIERS,
4766
python_requires=">=3.7",
4867
install_requires=requirements,
49-
entry_points={"console_scripts": ["teosd=teos.teosd:run", "teos-cli=teos.cli.teos_cli:run"]},
68+
entry_points={"console_scripts": CONSOLE_SCRIPTS},
5069
)

0 commit comments

Comments
 (0)