Skip to content

Commit

Permalink
add command line helper script
Browse files Browse the repository at this point in the history
  • Loading branch information
danicat committed Jun 22, 2023
1 parent c186ff5 commit c2a32b6
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,5 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

.vscode/
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.PHONY: clean
clean:
rm -rf build/
rm -rf datasus.egg-info/
rm -rf dist

.PHONY: build
build:
python3 setup.py build

install: build
python3 setup.py install
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setuptools
20 changes: 20 additions & 0 deletions scripts/dbc2dbf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# datasus
import sys

from datasus import decompress

def usage():
print("dbc2dbf.py: convert datasus *.dbc file to *.dbf")
print("usage:")
print("dbc2dbf.py file.dbc file.dbf")

def main() -> int:
"""decompress a *.dbc file into a *.dbf file"""
if len(sys.argv) < 3:
usage()
return -1

return decompress(sys.argv[1], sys.argv[2])

if __name__ == '__main__':
sys.exit(main())
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
ext_modules=[
Extension(
name="datasus",
sources=["src/decompress.c", "src/blast.c"],
sources=["datasus/decompress.c", "datasus/blast.c"],
language="c",
),
]
],
scripts=['scripts/dbc2dbf.py'],
)

0 comments on commit c2a32b6

Please sign in to comment.