Skip to content

Commit 7352ccd

Browse files
committed
pip-ready
1 parent cb4a86f commit 7352ccd

File tree

7 files changed

+139
-40
lines changed

7 files changed

+139
-40
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
*.py[cod]
22
*.egg-info
33
.ropeproject
4+
.idea
5+
dist/

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include README.rst
2+
include LICENSE
3+

README.md

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

README.rst

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
Nginx Configuration Parser
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
An nginx configuration parser that uses Pyparsing.
5+
6+
You can parse a nginx configuration file with ``load`` or ``loads``
7+
method:
8+
9+
.. code:: python
10+
11+
>>> from nginxparser_eb import load
12+
>>> load(open("/etc/nginx/sites-enabled/foo.conf"))
13+
14+
'[['server'], [
15+
['listen', '80'],
16+
['server_name', 'foo.com'],
17+
['root', '/home/ubuntu/sites/foo/']]]]
18+
'
19+
20+
Same as other serialization modules also you can export configuration
21+
with
22+
23+
.. code:: python
24+
25+
>>> from nginxparser_eb import load
26+
>>> load(open("/etc/nginx/sites-enabled/foo.conf"))
27+
28+
'[['server'], [
29+
['listen', '80'],
30+
['server_name', 'foo.com'],
31+
['root', '/home/ubuntu/sites/foo/']]]]
32+
'
33+
34+
Same as other serialization modules also you can export configuration
35+
with
36+
37+
.. code:: python
38+
39+
>>> from nginxparser import load
40+
>>> load(open("/etc/nginx/sites-enabled/foo.conf"))
41+
42+
'[['server'], [
43+
['listen', '80'],
44+
['server_name', 'foo.com'],
45+
['root', '/home/ubuntu/sites/foo/']]]]
46+
'
47+
48+
Same as other serialization modules also you can export configuration
49+
with ``dump`` and ``dumps`` methods.
50+
51+
.. code:: python
52+
53+
>>> from nginxparser_eb import dumps
54+
>>> dumps([['server'], [
55+
['listen', '80'],
56+
['server_name', 'foo.com'],
57+
['root', '/home/ubuntu/sites/foo/']]])
58+
59+
'server {
60+
listen 80;
61+
server_name foo.com;
62+
root /home/ubuntu/sites/foo/;
63+
}'
64+
65+
66+
.. code:: python
67+
68+
>>> from nginxparser_eb import dumps
69+
>>> dumps([['server'], [
70+
['listen', '80'],
71+
['server_name', 'foo.com'],
72+
['root', '/home/ubuntu/sites/foo/']]])
73+
74+
'server {
75+
listen 80;
76+
server_name foo.com;
77+
root /home/ubuntu/sites/foo/;
78+
}'
79+
80+
81+
.. code:: python
82+
83+
>>> from nginxparser import dumps
84+
>>> dumps([['server'], [
85+
['listen', '80'],
86+
['server_name', 'foo.com'],
87+
['root', '/home/ubuntu/sites/foo/']]])
88+
89+
'server {
90+
listen 80;
91+
server_name foo.com;
92+
root /home/ubuntu/sites/foo/;
93+
}'
94+
95+
96+
Installation
97+
------------
98+
99+
::
100+
101+
pip install nginxparser_eb
102+
File renamed without changes.

setup.py

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,36 @@
1-
from distutils.core import setup
1+
from setuptools import setup
2+
from setuptools import find_packages
23

3-
setup(name='Nginxparser',
4-
version='0.3',
5-
description='Nginx Parser',
4+
setup(name='nginxparser_eb',
5+
version='0.0.2',
6+
description='Nginx configuration Parser',
67
author='Fatih Erikli',
78
author_email='fatiherikli@gmail.com',
8-
url='https://github.com/fatiherikli/nginxparser',
9-
py_modules=['nginxparser'],
10-
install_requires = [
9+
url='https://github.com/EnigmaBridge/nginxparser',
10+
license=open('LICENSE').read(),
11+
long_description=open('README.rst').read(),
12+
classifiers=[
13+
'Development Status :: 3 - Alpha',
14+
'Intended Audience :: Developers',
15+
'Programming Language :: Python',
16+
'Programming Language :: Python :: 2',
17+
'Programming Language :: Python :: 2.6',
18+
'Programming Language :: Python :: 2.7',
19+
'Programming Language :: Python :: 3',
20+
'Programming Language :: Python :: 3.3',
21+
'Programming Language :: Python :: 3.4',
22+
'Programming Language :: Python :: 3.5',
23+
'Topic :: Internet :: WWW/HTTP'
24+
],
25+
26+
packages=find_packages(),
27+
include_package_data=True,
28+
install_requires=[
1129
'pyparsing>=1.5.5'
12-
]
30+
],
31+
extras_require={
32+
'dev': ['mockio']
33+
},
1334
)
35+
36+

tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from mockio import mockio
55

6-
from nginxparser import NginxParser, load, dumps
6+
from nginxparser_eb import NginxParser, load, dumps
77

88

99
first = operator.itemgetter(0)

0 commit comments

Comments
 (0)