Skip to content

Commit

Permalink
update package to use with pip
Browse files Browse the repository at this point in the history
  • Loading branch information
royopa committed Feb 12, 2017
1 parent 73fe419 commit 9cfce6e
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 1 deletion.
66 changes: 65 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,65 @@
*.pyc
*.pyc
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

#Ipython Notebook
.ipynb_checkpoints

.idea
25 changes: 25 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
language: python

python:
- "2.6"
- "2.7"
- "3.2"
- "3.3"
- "3.4"
- "3.5"
- "3.5-dev" # 3.5 development branch
- "3.6"
- "3.6-dev" # 3.6 development branch
- "3.7-dev" # 3.7 development branch
- "nightly" # currently points to 3.7-dev

sudo: required

install:
- pip install coveralls

script:
- coverage run --source=python-cobol setup.py test

after_success:
- coveralls
12 changes: 12 additions & 0 deletions readme.md → README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# COBOL Copybook parser in Python

This is a COBOL Copybook parser in Python featuring the following options:
- Parse the Copybook into a usable format to use in Python
- Clean up the Copybook by processing REDEFINES statements and remove unused definitions
Expand All @@ -15,7 +16,15 @@ The code uses the pic parser code from [pyCOBOL](http://www.travelingfrontiers.c

This code is licensed under GPLv3.

## Installation
The easiest way to install `python-cobol` is using `pip`:

```sh
pip install python-cobol
```

## Example output

Below is an example Copybook file before and after being processed.

Before:
Expand Down Expand Up @@ -47,9 +56,11 @@ After:


## How to use

You can use it in two ways: inside your own python code or as a stand-alone command-line utility.

### Command-line

Do a git clone from the repository and inside your brand new python-cobol folder run:

python cobol.py example.cbl
Expand Down Expand Up @@ -77,6 +88,7 @@ The utility allows for some command-line switches to disable some processing ste
--skip-strip-prefix Skips stripping the prefix from the names.

### From within your Python code

The parser can also be called from your Python code. All you need is a list of lines in COBOL Copybook format. See example.py how one would do it:

```python
Expand Down
2 changes: 2 additions & 0 deletions python-cobol/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
2 changes: 2 additions & 0 deletions cobol.py → python-cobol/cobol.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re

class CobolPatterns:
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
description-file = README.md
16 changes: 16 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup

setup(
name='python-cobol',
version='0.1.1',
url='https://github.com/royopa/python-cobol',
license='GPLv3',
author='Paulus Schoutsen',
author_email='paulus@paulusschoutsen.nl',
keywords='cobol mainframe copybook',
description=u'Python code to parse and denormalize COBOL Copybooks',
packages=['python-cobol'],
install_requires=[],
)
2 changes: 2 additions & 0 deletions test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
File renamed without changes.
2 changes: 2 additions & 0 deletions example.py → test/example.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cobol

with open("example.cbl",'r') as f:
Expand Down

0 comments on commit 9cfce6e

Please sign in to comment.