Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Commit

Permalink
PyPi Package (#2)
Browse files Browse the repository at this point in the history
* Setup.py now includes data files
  • Loading branch information
NyanKiyoshi authored Feb 19, 2018
1 parent 846adc0 commit a7d6b07
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 75 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include invoice_generator *.html *.css *.svg *.mo
4 changes: 4 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
invoice-generator
======

Generate invoices using python, weasyprint and django.
26 changes: 0 additions & 26 deletions README.md

This file was deleted.

4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

58 changes: 13 additions & 45 deletions setup.py
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'
],
),
)

0 comments on commit a7d6b07

Please sign in to comment.