Skip to content

Commit 04d2aee

Browse files
committed
Update setup.py, prepare for release
1 parent 7773bfc commit 04d2aee

File tree

4 files changed

+198
-15
lines changed

4 files changed

+198
-15
lines changed

AUTHORS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Authors
2+
3+
* [Ryan Court](//www.linkedin.com/in/rccourt)
4+
* [Kevin Z. Snow](//www.linkedin.com/in/kevinsnow/)
5+
* [Kevin Valakuzhy](//www.linkedin.com/in/kevin-valakuzhy-319a5447/)
6+
* Suyup Kim

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Version 0.0.1] - 2020-08-05
9+
10+
Initial public release.
11+
12+
### Added
13+
14+
- Initial open source commit.
15+
16+
### Changed
17+
18+
- N/A
19+
20+
### Removed
21+
22+
- N/A
23+
24+
[0.0.1]: https://github.com/zeropointdynamics/zelos-crashd/releases/tag/v0.0.1

setup.py

Lines changed: 155 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,159 @@
1-
from setuptools import find_packages, setup
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
23

4+
# Note: To use the 'upload' functionality of this file, you must:
5+
# $ pipenv install twine --dev
6+
7+
import codecs
8+
import os
9+
import re
10+
import sys
11+
12+
from shutil import rmtree
13+
14+
from setuptools import Command, find_packages, setup
15+
16+
NAME = "zelos-crashd"
17+
META_PATH = os.path.join("src", "crashd", "__init__.py")
318
PACKAGES = find_packages(where="src")
19+
KEYWORDS = [
20+
"emulation",
21+
"dynamic analysis",
22+
"binary analysis",
23+
"zelos",
24+
"crash",
25+
"vulnerability assessment",
26+
]
27+
PROJECT_URLS = {
28+
"Bug Tracker": "https://github.com/zeropointdynamics/zelos-crashd/issues",
29+
"Source Code": "https://github.com/zeropointdynamics/zelos-crashd",
30+
}
31+
CLASSIFIERS = [
32+
"Development Status :: 4 - Beta",
33+
"Natural Language :: English",
34+
"License :: OSI Approved :: GNU Affero General Public License v3",
35+
"Operating System :: OS Independent",
36+
"Programming Language :: Python",
37+
"Programming Language :: Python :: 3",
38+
"Programming Language :: Python :: 3.6",
39+
"Programming Language :: Python :: 3.7",
40+
"Programming Language :: Python :: 3.8",
41+
]
42+
INSTALL_REQUIRES = [
43+
"zelos>=0.2.0",
44+
"graphviz",
45+
"pyelftools@git+git://github.com/eliben/pyelftools.git@7ca16680f4eb01e6b6bbbc222f18de56460426d1",
46+
]
47+
48+
########################################################################
49+
50+
HERE = os.path.abspath(os.path.dirname(__file__))
51+
52+
53+
def read(*parts):
54+
"""
55+
Build an absolute path from *parts* and and return the contents of
56+
the resulting file. Assume UTF-8 encoding.
57+
"""
58+
with codecs.open(os.path.join(HERE, *parts), "rb", "utf-8") as f:
59+
return f.read()
60+
61+
62+
META_FILE = read(META_PATH)
63+
64+
65+
def find_meta(meta):
66+
"""
67+
Extract __*meta*__ from META_FILE.
68+
"""
69+
meta_match = re.search(
70+
r"^__{meta}__ = ['\"]([^'\"]*)['\"]".format(meta=meta), META_FILE, re.M
71+
)
72+
if meta_match:
73+
return meta_match.group(1)
74+
raise RuntimeError("Unable to find __{meta}__ string.".format(meta=meta))
75+
476

5-
setup(
6-
name="zelos_crashd",
7-
# install_requires=["zelos", "graphviz"],
8-
install_requires=[],
9-
include_package_data=True,
10-
packages=PACKAGES,
11-
package_dir={"": "src"},
12-
entry_points={
13-
"zelos.plugins": [
14-
"asan=crashd.asan",
15-
"dataflow=crashd.taint",
16-
"ida=crashd.static_analysis",
17-
],
18-
},
77+
VERSION = find_meta("version")
78+
URL = find_meta("url")
79+
LONG = (
80+
read("README.md")
81+
+ "\n\n"
82+
+ read("CHANGELOG.md")
83+
+ "\n\n"
84+
+ read("AUTHORS.md")
1985
)
86+
87+
88+
class UploadCommand(Command):
89+
"""Support setup.py upload."""
90+
91+
description = "Build and publish the package."
92+
user_options = []
93+
94+
@staticmethod
95+
def status(s):
96+
"""Prints things in bold."""
97+
print("\033[1m{0}\033[0m".format(s))
98+
99+
def initialize_options(self):
100+
pass
101+
102+
def finalize_options(self):
103+
pass
104+
105+
def run(self):
106+
try:
107+
self.status("Removing previous builds…")
108+
rmtree(os.path.join(HERE, "dist"))
109+
except OSError:
110+
pass
111+
112+
self.status("Building Source and Wheel (universal) distribution…")
113+
os.system(
114+
"{0} setup.py sdist bdist_wheel --universal".format(sys.executable)
115+
)
116+
117+
self.status("Uploading the package to PyPI via Twine…")
118+
os.system("twine upload dist/*")
119+
120+
self.status("Pushing git tags…")
121+
os.system("git tag v{0}".format(VERSION))
122+
os.system("git push --tags")
123+
124+
sys.exit()
125+
126+
127+
if __name__ == "__main__":
128+
setup(
129+
name=NAME,
130+
description=find_meta("description"),
131+
license=find_meta("license"),
132+
url=URL,
133+
project_urls=PROJECT_URLS,
134+
version=VERSION,
135+
author=find_meta("author"),
136+
author_email=find_meta("email"),
137+
maintainer=find_meta("author"),
138+
maintainer_email=find_meta("email"),
139+
keywords=KEYWORDS,
140+
long_description=LONG,
141+
long_description_content_type="text/markdown",
142+
packages=PACKAGES,
143+
package_dir={"": "src"},
144+
python_requires=">=3.6.0",
145+
zip_safe=False,
146+
classifiers=CLASSIFIERS,
147+
install_requires=INSTALL_REQUIRES,
148+
include_package_data=True,
149+
options={"bdist_wheel": {"universal": "1"}},
150+
setup_requires=["wheel"],
151+
cmdclass={"upload": UploadCommand},
152+
entry_points={
153+
"zelos.plugins": [
154+
"asan=crashd.asan",
155+
"dataflow=crashd.taint",
156+
"ida=crashd.static_analysis",
157+
],
158+
},
159+
)

src/crashd/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,16 @@
1414
# License along with this program. If not, see
1515
# <http://www.gnu.org/licenses/>.
1616
# ======================================================================
17+
__version__ = "0.0.1"
18+
19+
__title__ = "zelos-crashd"
20+
__description__ = "A zelos plugin for crash analysis."
21+
__url__ = "https://github.com/zeropointdynamics/zelos-crashd"
22+
__uri__ = __url__
23+
__doc__ = __description__ + " <" + __uri__ + ">"
24+
25+
__author__ = "Zeropoint Dynamics"
26+
__email__ = "zelos@zeropointdynamics.com"
27+
28+
__license__ = "AGPLv3"
29+
__copyright__ = "Copyright (c) 2020 Zeropoint Dynamics"

0 commit comments

Comments
 (0)