diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-10 05:08:05 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-10 05:08:05 +0000 |
| commit | da6b10d836e4e6a3a68848518d905bcdd823e5ee (patch) | |
| tree | 3a7eccf8d76e5636eaa7d9a4922b1819df6a6f84 /python-comment-parser.spec | |
| parent | 6557a68f0b9d6c279b2f32395947e3fa4d707b7f (diff) | |
automatic import of python-comment-parseropeneuler20.03
Diffstat (limited to 'python-comment-parser.spec')
| -rw-r--r-- | python-comment-parser.spec | 552 |
1 files changed, 552 insertions, 0 deletions
diff --git a/python-comment-parser.spec b/python-comment-parser.spec new file mode 100644 index 0000000..ac2239f --- /dev/null +++ b/python-comment-parser.spec @@ -0,0 +1,552 @@ +%global _empty_manifest_terminate_build 0 +Name: python-comment-parser +Version: 1.2.4 +Release: 1 +Summary: Parse comments from various source files. +License: MIT +URL: http://github.com/jeanralphaviles/comment_parser +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/76/cd/6e4c79d4a25e3b6542d1a3728b3e2b2c4650e3f8c3cde950aaecc6f64764/comment_parser-1.2.4.tar.gz +BuildArch: noarch + + +%description +# Comment Parser + +[](https://travis-ci.org/jeanralphaviles/comment_parser/branches) +[](https://pypi.python.org/pypi/comment_parser/) +[](https://pypi.python.org/pypi/comment_parser/) +[](https://pypi.python.org/pypi/comment_parser/) +[](https://pypi.python.org/pypi/comment_parser/) + +Python module used to extract comments from source code files of various types. + +## Installation + +### Prerequisites + +* libmagic + +### Linux/Unix + +```shell +sudo pip3 install comment_parser +``` + +### OSX and Windows +Additionally, complete the special installation requirements for +[python-magic](https://github.com/ahupp/python-magic). + +## Usage + +To use, simply run: + +```python +>>> from comment_parser import comment_parser +>>> # Returns a list of comment_parser.parsers.common.Comments +>>> comment_parser.extract_comments('/path/to/source_file') +>>> # Or +>>> comment_parser.extract_comments_from_str('...') +``` +### extract_comments signatures + +```python +def extract_comments(filename, mime=None): + """Extracts and returns the comments from the given source file. + + Args: + filename: String name of the file to extract comments from. + mime: Optional MIME type for file (str). Note some MIME types accepted + don't comply with RFC2045. If not given, an attempt to deduce the + MIME type will occur. + Returns: + Python list of parsers.common.Comment in the order that they appear in + the source file. + Raises: + UnsupportedError: If filename is of an unsupported MIME type. + """ + pass + + +def extract_comments_from_str(code, mime=None): + """Extracts and returns comments from the given source string. + + Args: + code: String containing code to extract comments from. + mime: Optional MIME type for code (str). Note some MIME types accepted + don't comply with RFC2045. If not given, an attempt to deduce the + MIME type will occur. + Returns: + Python list of parsers.common.Comment in the order that they appear in + the source code. + Raises: + UnsupportedError: If code is of an unsupported MIME type. + """ + pass +``` +### Comments Interface + +```python +class Comment(object): + """Represents comments found in source files.""" + def text(self): + """Returns the comment's text. + Returns: + String + """ + pass + + def line_number(self): + """Returns the line number the comment was found on. + Returns: + Int + """ + pass + + def is_multiline(self): + """Returns whether this comment was a multiline comment. + Returns: + True if comment was a multiline comment, False if not. + """ + pass + + def __str__(self): + pass + + def __eq__(self, other): + pass +``` + +## Development + +### Running locally + +Start python3 in the base of repository. + +```python +from comment_parser import comment_parser +comment_parser.extract_comments('foo.c', mime='text/x-c') +``` + +### Running tests + +```shell +python3 setup.py test +``` + +### Running pylint + +```shell +pylint comment_parser +``` + +### Running formatter + +```shell +yapf -rip --style=yapf . +``` + +### Deploying to PyPi + +```shell +python3 setup.py sdist +twine upload dist/* +``` + +## Supported Programming Languages + +| Language | Mime String | +|------------ |------------------------- | +| C | text/x-c | +| C++/C# | text/x-c++ | +| Go | text/x-go | +| HTML | text/html | +| Java | text/x-java-source | +| Javascript | application/javascript | +| Python | text/x-python | +| Python | text/x-script.python | +| Ruby | text/x-ruby | +| Shell | text/x-shellscript | +| XML | text/xml | + +And more to come! + +*Check comment_parser.py for corresponding MIME types.* + +%package -n python3-comment-parser +Summary: Parse comments from various source files. +Provides: python-comment-parser +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-comment-parser +# Comment Parser + +[](https://travis-ci.org/jeanralphaviles/comment_parser/branches) +[](https://pypi.python.org/pypi/comment_parser/) +[](https://pypi.python.org/pypi/comment_parser/) +[](https://pypi.python.org/pypi/comment_parser/) +[](https://pypi.python.org/pypi/comment_parser/) + +Python module used to extract comments from source code files of various types. + +## Installation + +### Prerequisites + +* libmagic + +### Linux/Unix + +```shell +sudo pip3 install comment_parser +``` + +### OSX and Windows +Additionally, complete the special installation requirements for +[python-magic](https://github.com/ahupp/python-magic). + +## Usage + +To use, simply run: + +```python +>>> from comment_parser import comment_parser +>>> # Returns a list of comment_parser.parsers.common.Comments +>>> comment_parser.extract_comments('/path/to/source_file') +>>> # Or +>>> comment_parser.extract_comments_from_str('...') +``` +### extract_comments signatures + +```python +def extract_comments(filename, mime=None): + """Extracts and returns the comments from the given source file. + + Args: + filename: String name of the file to extract comments from. + mime: Optional MIME type for file (str). Note some MIME types accepted + don't comply with RFC2045. If not given, an attempt to deduce the + MIME type will occur. + Returns: + Python list of parsers.common.Comment in the order that they appear in + the source file. + Raises: + UnsupportedError: If filename is of an unsupported MIME type. + """ + pass + + +def extract_comments_from_str(code, mime=None): + """Extracts and returns comments from the given source string. + + Args: + code: String containing code to extract comments from. + mime: Optional MIME type for code (str). Note some MIME types accepted + don't comply with RFC2045. If not given, an attempt to deduce the + MIME type will occur. + Returns: + Python list of parsers.common.Comment in the order that they appear in + the source code. + Raises: + UnsupportedError: If code is of an unsupported MIME type. + """ + pass +``` +### Comments Interface + +```python +class Comment(object): + """Represents comments found in source files.""" + def text(self): + """Returns the comment's text. + Returns: + String + """ + pass + + def line_number(self): + """Returns the line number the comment was found on. + Returns: + Int + """ + pass + + def is_multiline(self): + """Returns whether this comment was a multiline comment. + Returns: + True if comment was a multiline comment, False if not. + """ + pass + + def __str__(self): + pass + + def __eq__(self, other): + pass +``` + +## Development + +### Running locally + +Start python3 in the base of repository. + +```python +from comment_parser import comment_parser +comment_parser.extract_comments('foo.c', mime='text/x-c') +``` + +### Running tests + +```shell +python3 setup.py test +``` + +### Running pylint + +```shell +pylint comment_parser +``` + +### Running formatter + +```shell +yapf -rip --style=yapf . +``` + +### Deploying to PyPi + +```shell +python3 setup.py sdist +twine upload dist/* +``` + +## Supported Programming Languages + +| Language | Mime String | +|------------ |------------------------- | +| C | text/x-c | +| C++/C# | text/x-c++ | +| Go | text/x-go | +| HTML | text/html | +| Java | text/x-java-source | +| Javascript | application/javascript | +| Python | text/x-python | +| Python | text/x-script.python | +| Ruby | text/x-ruby | +| Shell | text/x-shellscript | +| XML | text/xml | + +And more to come! + +*Check comment_parser.py for corresponding MIME types.* + +%package help +Summary: Development documents and examples for comment-parser +Provides: python3-comment-parser-doc +%description help +# Comment Parser + +[](https://travis-ci.org/jeanralphaviles/comment_parser/branches) +[](https://pypi.python.org/pypi/comment_parser/) +[](https://pypi.python.org/pypi/comment_parser/) +[](https://pypi.python.org/pypi/comment_parser/) +[](https://pypi.python.org/pypi/comment_parser/) + +Python module used to extract comments from source code files of various types. + +## Installation + +### Prerequisites + +* libmagic + +### Linux/Unix + +```shell +sudo pip3 install comment_parser +``` + +### OSX and Windows +Additionally, complete the special installation requirements for +[python-magic](https://github.com/ahupp/python-magic). + +## Usage + +To use, simply run: + +```python +>>> from comment_parser import comment_parser +>>> # Returns a list of comment_parser.parsers.common.Comments +>>> comment_parser.extract_comments('/path/to/source_file') +>>> # Or +>>> comment_parser.extract_comments_from_str('...') +``` +### extract_comments signatures + +```python +def extract_comments(filename, mime=None): + """Extracts and returns the comments from the given source file. + + Args: + filename: String name of the file to extract comments from. + mime: Optional MIME type for file (str). Note some MIME types accepted + don't comply with RFC2045. If not given, an attempt to deduce the + MIME type will occur. + Returns: + Python list of parsers.common.Comment in the order that they appear in + the source file. + Raises: + UnsupportedError: If filename is of an unsupported MIME type. + """ + pass + + +def extract_comments_from_str(code, mime=None): + """Extracts and returns comments from the given source string. + + Args: + code: String containing code to extract comments from. + mime: Optional MIME type for code (str). Note some MIME types accepted + don't comply with RFC2045. If not given, an attempt to deduce the + MIME type will occur. + Returns: + Python list of parsers.common.Comment in the order that they appear in + the source code. + Raises: + UnsupportedError: If code is of an unsupported MIME type. + """ + pass +``` +### Comments Interface + +```python +class Comment(object): + """Represents comments found in source files.""" + def text(self): + """Returns the comment's text. + Returns: + String + """ + pass + + def line_number(self): + """Returns the line number the comment was found on. + Returns: + Int + """ + pass + + def is_multiline(self): + """Returns whether this comment was a multiline comment. + Returns: + True if comment was a multiline comment, False if not. + """ + pass + + def __str__(self): + pass + + def __eq__(self, other): + pass +``` + +## Development + +### Running locally + +Start python3 in the base of repository. + +```python +from comment_parser import comment_parser +comment_parser.extract_comments('foo.c', mime='text/x-c') +``` + +### Running tests + +```shell +python3 setup.py test +``` + +### Running pylint + +```shell +pylint comment_parser +``` + +### Running formatter + +```shell +yapf -rip --style=yapf . +``` + +### Deploying to PyPi + +```shell +python3 setup.py sdist +twine upload dist/* +``` + +## Supported Programming Languages + +| Language | Mime String | +|------------ |------------------------- | +| C | text/x-c | +| C++/C# | text/x-c++ | +| Go | text/x-go | +| HTML | text/html | +| Java | text/x-java-source | +| Javascript | application/javascript | +| Python | text/x-python | +| Python | text/x-script.python | +| Ruby | text/x-ruby | +| Shell | text/x-shellscript | +| XML | text/xml | + +And more to come! + +*Check comment_parser.py for corresponding MIME types.* + +%prep +%autosetup -n comment-parser-1.2.4 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-comment-parser -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 1.2.4-1 +- Package Spec generated |
