|
4 | 4 | # --------------------------------------
|
5 | 5 |
|
6 | 6 | import os
|
7 |
| -import glob |
8 | 7 | import setuptools
|
| 8 | +import setupextras |
9 | 9 |
|
10 | 10 | # DISABLED/BUG: this line fails when `pip install connection_uri` but works `pip install .`
|
11 | 11 | # from connection_uri import __version__
|
12 | 12 |
|
13 | 13 |
|
14 |
| -# ========================================= |
15 |
| -# FUNCTIONS |
16 |
| -# -------------------------------------- |
17 |
| - |
18 |
| -def find_data_files(data_file_patterns = [], root_path = None): |
19 |
| - root_path = root_path or os.path.abspath(os.path.dirname(__file__)) |
20 |
| - data_file_dirs = [] |
21 |
| - |
22 |
| - for root, dirs, files in os.walk(root_path): |
23 |
| - data_file_dirs.append(root) |
24 |
| - |
25 |
| - data_files = [] |
26 |
| - |
27 |
| - for data_file_dir in data_file_dirs: |
28 |
| - files = [] |
29 |
| - |
30 |
| - for data_file_pattern in data_file_patterns: |
31 |
| - files += glob.glob(os.path.join(data_file_dir, data_file_pattern)) |
32 |
| - |
33 |
| - if not files: |
34 |
| - continue |
35 |
| - |
36 |
| - target = os.path.join(root_path, data_file_dir) |
37 |
| - |
38 |
| - data_files.append((target, files)) |
39 |
| - |
40 |
| - return data_files |
41 |
| - |
42 |
| -def get_readme(): |
43 |
| - root_path = os.path.abspath(os.path.dirname(__file__)) |
44 |
| - readme_file_path = os.path.join(root_path, 'README.md') |
45 |
| - |
46 |
| - with open(readme_file_path) as file: |
47 |
| - readme = file.read() |
48 |
| - |
49 |
| - return readme |
50 |
| - |
51 |
| -def get_requirements(): |
52 |
| - root_path = os.path.abspath(os.path.dirname(__file__)) |
53 |
| - requirements_file_path = os.path.join(root_path, 'requirements.txt') |
54 |
| - |
55 |
| - with open(requirements_file_path) as file: |
56 |
| - requirements = [requirement.strip() for requirement in file.readlines()] |
57 |
| - requirements = filter(lambda requirement: len(requirement), requirements) |
58 |
| - requirements = list(requirements) |
59 |
| - |
60 |
| - return requirements |
61 |
| - |
62 |
| - |
63 | 14 | # =========================================
|
64 | 15 | # MAIN
|
65 | 16 | # --------------------------------------
|
@@ -88,10 +39,10 @@ def get_requirements():
|
88 | 39 | 'multi-host',
|
89 | 40 | ]
|
90 | 41 |
|
91 |
| -readme = get_readme() |
92 |
| -requirements = get_requirements() |
93 |
| -packages = setuptools.find_packages() |
94 |
| -data_files = find_data_files(['*.*'], os.path.join(name, 'tests', '__fixtures__')) |
| 42 | +packages = setupextras.get_packages() |
| 43 | +data_files = setupextras.get_data_files(['*.*'], os.path.join(name, 'tests', '__fixtures__')) |
| 44 | +requirements = setupextras.get_requirements() |
| 45 | +readme = setupextras.get_readme() |
95 | 46 |
|
96 | 47 | config = {
|
97 | 48 | 'name': name,
|
|
0 commit comments