-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
123 lines (102 loc) · 3.79 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/usr/bin/env python
import sys
import re
def setup_python3():
# Taken from "distribute" setup.py
from distutils.filelist import FileList
from distutils import dir_util, file_util, util, log
from os.path import join
tmp_src = join("build", "src")
log.set_verbosity(1)
fl = FileList()
for line in open("MANIFEST.in"):
if not line.strip():
continue
fl.process_template_line(line)
dir_util.create_tree(tmp_src, fl.files)
outfiles_2to3 = []
for f in fl.files:
outf, copied = file_util.copy_file(f, join(tmp_src, f), update=1)
if copied and outf.endswith(".py"):
outfiles_2to3.append(outf)
util.run_2to3(outfiles_2to3)
# arrange setup to use the copy
sys.path.insert(0, tmp_src)
return tmp_src
kwargs = {}
if sys.version_info[0] >= 3:
from setuptools import setup
kwargs['use_2to3'] = True
kwargs['src_root'] = setup_python3()
else:
try:
from setuptools import setup
kwargs['test_suite'] = "nose.collector"
except ImportError:
try:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
except ImportError:
from distutils.core import setup
# Find version. We have to do this because we can't import it in Python 3 until
# its been automatically converted in the setup process.
def find_version(filename):
_version_re = re.compile(r'__version__ = "(.*)"')
for line in open(filename):
version_match = _version_re.match(line)
if version_match:
return version_match.group(1)
__version__ = find_version('rdfalchemy/__init__.py')
setup(
name='RDFAlchemy',
version=__version__,
description="rdflib wrapper",
author='Philip Cooper',
author_email='[email protected]',
url="http://www.openvest.com/trac/wiki/RDFAlchemy",
download_url="http://www.openvest.com/public/downloads/RDFAlchemy-%s.tar.gz"%__version__,
install_requires=["rdflib"],
packages=['rdfalchemy',
'rdfalchemy/engine',
'rdfalchemy/samples',
'rdfalchemy/sparql',
],
include_package_data=True,
keywords = "RDF SPARQL",
entry_points = {
'console_scripts': [
'sparql = rdfalchemy.sparql.script:main',
],
},
platforms = ["any"],
classifiers = ["Programming Language :: Python",
"License :: OSI Approved :: BSD License",
"Topic :: Software Development :: Libraries :: Python Modules",
"Operating System :: OS Independent",
"Natural Language :: English",
],
long_description = """RDFAlchemy is an abstraction layer, allowing python
developers to use familiar *dot notation* to access and update an rdf triplestore.
* RDFAlchemy is an **ORM** (Object Rdf Mapper) for graph data as:
* SQLAlchemy is an **ORM** (Object Relational Mapper) for relational databases
Allows access to:
* rdflib_ datastores
* Sesame_ Repositories
* SPARQL_ endpoints
Provides intuitive access to RDF values by accessing predicate values
through dot notation. ::
ov = Namespace('http://owl.openvest.org/2005/10/Portfolio#')
class Company(rdfSubject):
rdf_type = ov.Company
symbol = rdfSingle(ov.symbol,'symbol') #second param is optional
cik = rdfSingle(ov.secCik)
companyName = rdfSingle(ov.companyName)
c = Company.query.get_by(symbol = 'IBM')
print("%s has an SEC symbol of %s" % (c.companyName, c.cik))
Includes advanced descriptors for read/write access to lists and collections.
.. _rdflib: https://github.com/RDFLib/rdflib
.. _Sesame: http://www.openrdf.org
.. _SPARQL: http://www.w3.org/TR/rdf-sparql-query/
"""
)