Skip to content

Commit 0b5e3ce

Browse files
committed
fix aggregation include pattern & create release
1 parent bc85eca commit 0b5e3ce

File tree

4 files changed

+17
-87
lines changed

4 files changed

+17
-87
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
.idea
2-
*.pyc
3-
*.pyi
42
test/
53
dist/
64
cosmospy_protobuf.egg-info

aggregate.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import errno
21
import json
32
import os
43
import shutil
54
import time
6-
from os.path import dirname, abspath, isfile
5+
from os.path import dirname, abspath, isfile, isdir
6+
import fnmatch
77
import argparse
88

99
from git import Repo
@@ -12,6 +12,16 @@
1212
parser.add_argument('coin', type=str, help="Coin to parse from the .json file in the config folder")
1313
args = parser.parse_args()
1414

15+
# https://stackoverflow.com/questions/52071642/python-copying-the-files-with-include-pattern
16+
def include_patterns(*patterns):
17+
def _ignore_patterns(path, names):
18+
keep = set(name for pattern in patterns
19+
for name in fnmatch.filter(names, pattern))
20+
ignore = set(name for name in names
21+
if name not in keep and not isdir(os.path.join(path, name)))
22+
return ignore
23+
24+
return _ignore_patterns
1525
# Get current directory
1626
d = dirname(abspath(__file__))
1727

@@ -38,6 +48,9 @@
3848
root_dir = 'src/cosmospy_protobuf'
3949
root_abs_path = os.path.join(d, root_dir)
4050
for filename in os.listdir(root_abs_path):
51+
if filename == ".gitignore":
52+
continue
53+
4154
file_path = os.path.join(root_abs_path, filename)
4255
try:
4356
if os.path.isfile(file_path) or os.path.islink(file_path):
@@ -63,9 +76,9 @@
6376
proto_dir = os.path.join(repo_dir, proto_folder)
6477
category_name = proto_folder.split('/')[-1]
6578
try:
66-
shutil.copytree(proto_dir, root_abs_path + "/" + category_name, dirs_exist_ok=True, ignore=shutil.ignore_patterns("*.go"))
79+
shutil.copytree(proto_dir, root_abs_path + "/" + category_name, dirs_exist_ok=True, ignore=include_patterns("*.proto"))
6780
print(f"Copied {category_name}")
68-
except OSError as exc: # python >2.5
81+
except OSError as exc:
6982
try:
7083
shutil.copy(proto_dir, root_abs_path)
7184
print(f"File {proto_dir} copied successfully")

src/cosmospy_protobuf/gogoproto/Makefile

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/cosmospy_protobuf/gogoproto/gogo.pb.golden

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)