-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrelease.py
27 lines (22 loc) · 912 Bytes
/
release.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import tarfile
import yaml
from microdrop_utility import Version
from path_helpers import path
package_name = 'dropbot_dx_accessories_plugin'
plugin_name = 'wheelerlab.dropbot_dx_accessories'
# create a version sting based on the git revision/branch
version = str(Version.from_git_repository())
# write the 'properties.yml' file
properties = {'plugin_name': plugin_name, 'package_name': package_name,
'version': version}
with open('properties.yml', 'w') as f:
f.write(yaml.dump(properties))
# create the tar.gz plugin archive
with tarfile.open("%s-%s.tar.gz" % (package_name, version), "w:gz") as tar:
for name in ['__init__.py', 'properties.yml', 'hooks',
'on_plugin_install.py',
]:
tar.add(name)
requirements_file = path(__file__).parent.joinpath('requirements.txt')
if requirements_file.exists():
tar.add(requirements_file)