This repository has been archived by the owner on Sep 16, 2023. It is now read-only.
forked from ecmonline/invoice-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Setup.py now includes data files
- Loading branch information
NyanKiyoshi
authored
Feb 19, 2018
1 parent
846adc0
commit a7d6b07
Showing
5 changed files
with
18 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
recursive-include invoice_generator *.html *.css *.svg *.mo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
invoice-generator | ||
====== | ||
|
||
Generate invoices using python, weasyprint and django. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,32 @@ | ||
import os.path | ||
|
||
from pip.req import parse_requirements | ||
from pip.download import PipSession | ||
from setuptools import setup, find_packages | ||
from sys import version_info | ||
import os | ||
|
||
|
||
if not version_info > (3, 4): | ||
raise Exception('This project requires a Python version greater or equal than 3.5.') | ||
|
||
|
||
HERE = os.path.dirname(__file__) | ||
PKG_NAME = "invoice_generator" | ||
|
||
|
||
REQUIREMENTS = [ | ||
str(rq.req) for rq in parse_requirements( | ||
os.path.join(HERE, 'requirements.txt'), session=PipSession) | ||
] | ||
|
||
|
||
def _extract_datafiles(path, ext=None): | ||
if type(path) is not str: | ||
path = os.path.join(*path) | ||
|
||
extracted = [] | ||
|
||
for root, dirs, files in os.walk(path): | ||
if files: | ||
found_files = [ | ||
os.path.join(root, file) | ||
for file in files if not ext or file.endswith(ext) | ||
] | ||
|
||
if found_files: | ||
extracted.append((root, found_files)) | ||
|
||
return extracted | ||
|
||
|
||
data_files = _extract_datafiles(('invoice_generator', 'locale'), '.mo') +\ | ||
_extract_datafiles(('invoice_generator', 'templates')) | ||
data_files += [ | ||
('', ['README.md', 'LICENSE', 'requirements.txt']) | ||
] | ||
|
||
print(data_files) | ||
|
||
|
||
setup( | ||
version='0.0.1', | ||
author='NyanKiyoshi', | ||
author_email='[email protected]', | ||
url='https://github.com/NyanKiyoshi/invoice-generator', | ||
|
||
version='0.0.1.2', | ||
name=PKG_NAME, | ||
packages=find_packages(exclude=['tests']), | ||
data_files=data_files, | ||
include_package_data=True, | ||
keywords=[], | ||
install_requires=REQUIREMENTS, | ||
classifiers=[ | ||
install_requires=( | ||
'babel', | ||
'weasyprint', | ||
'django', | ||
), | ||
classifiers=( | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.5', | ||
'Programming Language :: Python :: 3 :: Only' | ||
], | ||
), | ||
) |