forked from sptonkin/fuzzyhashlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·78 lines (67 loc) · 2.4 KB
/
setup.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python
from setuptools import setup
import re
import platform
import os
import sys
def load_version(filename='fuzzyhashlib/version.py'):
"""Parse a __version__ number from a source file"""
with open(filename) as source:
text = source.read()
match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", text)
if not match:
msg = "Unable to find version number in {}".format(filename)
raise RuntimeError(msg)
version = match.group(1)
return version
# See if we have a pre-built libfuzzyhashlib for this platform.
arch, exetype = platform.architecture()
system = platform.system().lower()
machine = platform.machine().lower()
if machine in ['i686', 'x86']:
machine = 'x86_32'
if machine in ['amd64']:
machine = 'x86_64'
if system == 'windows':
ext = '.dll'
else:
ext = '.so'
#build the yara package data (shipped yar files)
package_data = []
for path, _, files in os.walk(os.path.join('fuzzyhashlib', 'libs')):
rootpath = path[len('fuzzyhashlib') + 1:]
for f in files:
if f.endswith('.so') or f.endswith('.dll'):
package_data.append(os.path.join(rootpath, f))
setup(
name="fuzzyhashlib",
version=load_version(),
packages=['fuzzyhashlib'],
#data_files=data_files,
package_data=dict(fuzzyhashlib=package_data),
zip_safe=False,
author="Stephen Tonkin",
author_email="[email protected]",
url="https://github.com/sptonkin/fuzzyhashlib",
description="Hashlib-like wrapper for several fuzzy hash algorithms.",
long_description=open('README.rst').read(),
license="GNU General Public License v3",
install_requires = [],
platforms=['linux'],
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Other Audience',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
#'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Security',
'Topic :: Software Development :: Libraries :: Python Modules',
],
test_suite="tests"
)
#if not data_files:
# print("\nWARNING: Could not find %s" % fuzzyhashlib_path)
# print("fuzzyhashlib may be unsupported on your system.")