forked from gemfileparser/gemfileparser
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
105 lines (81 loc) · 3.11 KB
/
Copy pathsetup.py
File metadata and controls
105 lines (81 loc) · 3.11 KB
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
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': "A library to parse Rubygem gemspec and Gemfile files and Cocoapods podspec and Podfile files using Python. Friendly fork of https://gitlab.com/balasankarc/gemfileparser",
'author': 'nexB',
'url': 'https://github.com/nexB/gemfileparser2',
'download_url': 'https://github.com/nexB/gemfileparser2',
'author_email': '[email protected]',
'version': '0.7.0',
'license': 'GPL-3+ and MIT',
'long_description': '''
Introduction
~~~~~~~~~~~~
Parse Ruby Gemfile's using Python. Supports Gemfiles, .gemspec and Cocoapods(.podspec) files. Friendly fork of https://gitlab.com/balasankarc/gemfileparser.
https://gitlab.com/balasankarc/gemfileparser can only detect particular type of dependency in `.gemspec` files like it can detect only `s.add_development_dependency "rspec", "~>1.3.1"` or `s.add_runtime_dependency "rspec", "~>1.3.1"` type of dependency. Dependency should be in these 2 format only.
https://github.com/nexB/gemfileparser2 can detect all format of dependencies. This fork supports Gemfiles, .gemspec files and Cocoapods(.podspec) files.
Installation
~~~~~~~~~~~~
| If using pip, use the command ``sudo pip install gemfileparser2``
| Else use the following commands
::
git clone https://github.com/balasankarc/gemfileparser2.git
cd gemfileparser2
python setup.py install
Usage
~~~~~
::
from gemfileparser2 import GemfileParser
parser = GemfileParser(<path to Gemfile>, <name of the application (optional)>)
dependency_dictionary = parser.parse()
The parse() method returns a dict object of the following format
::
{
'development': [list of dependency objects inside group 'development'],
'runtime': [list of runtime dependency objects],
.
.
.}
Each dependency object contains the following attributes
::
name - Name of the gem
requirement - Version requirement
autorequire - Autorequire value
source - Source URL of the gem
parent - Dependency of which gem
group - Group in which gem is a member of (default : runtime)
Example
^^^^^^^
::
from gemfileparser2 import GemfileParser
n = GemfileParser('Gemfile', 'diaspora')
deps = n.parse()
for key in deps:
if deps[key]:
print key
for dependency in deps[key]:
print "\t", dependency
Copyright
~~~~~~~~~
2015-2018 Balasankar C [email protected]
License
~~~~~~~
gemfileparser is released under two licenses: `GNU GPL version 3 (or above) License` and `MIT License`_.
.. _GNU GPL version 3 (or above) License: http://www.gnu.org/licenses/gpl
''',
'packages': ['gemfileparser2'],
'scripts': [],
'name': 'gemfileparser2'
}
setup(
classifiers=[
# Indicate who your project is intended for
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'License :: OSI Approved :: MIT',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
], **config)