Browse Source

Build para windows

pull/70/head
Danimar Ribeiro 8 years ago
parent
commit
b05bd19354
  1. 32
      .appveyor.yml
  2. 11
      pytrustnfe/nfe/danfe.py

32
.appveyor.yml

@ -0,0 +1,32 @@
version: 1.3.{build}
environment:
matrix:
- python: 35
- python: 35-x64
- python: 36
- python: 36-x64
install:
- SET PATH=C:\\Python%PYTHON%;c:\\Python%PYTHON%\\scripts;%PATH%
- python -m pip.__main__ install -U pip wheel setuptools
- pip install -r requirements.txt
build: off
build_script:
# configure version
- ps: >-
If ($env:APPVEYOR_REPO_TAG -Eq "true" ) {
$version = "$env:APPVEYOR_REPO_TAG_NAME"
} Else {
$version = "$env:APPVEYOR_BUILD_VERSION.dev0"
}
$version | Set-Content version.txt
- python setup.py build bdist_wheel
- ps: Get-ChildItem dist\*.whl | % { pip install $_.FullName }
test: off
test_script:
- pip list
- py.test -v tests
- ps: Get-ChildItem dist\*.whl | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }

11
pytrustnfe/nfe/danfe.py

@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# Classe para geração de PDF da DANFE a partir de xml etree.fromstring
import os
from io import BytesIO
from textwrap import wrap
@ -20,7 +20,6 @@ from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
def chunks(cString, nLen):
for start in range(0, len(cString), nLen):
yield cString[start:start+nLen]
@ -75,10 +74,14 @@ def get_image(path, width=1*cm):
class danfe(object):
def __init__(self, sizepage=A4, list_xml=None, recibo=True,
orientation='portrait', logo=None):
path = os.path.join(os.path.dirname(__file__), 'fonts')
pdfmetrics.registerFont(
TTFont('NimbusSanL-Regu', '../fonts/NimbusSanL Regular.ttf'))
TTFont('NimbusSanL-Regu',
os.path.join(path, 'NimbusSanL Regular.ttf')))
pdfmetrics.registerFont(
TTFont('NimbusSanL-Bold', '../fonts/NimbusSanL Bold.ttf'))
TTFont('NimbusSanL-Bold',
os.path.join(path, 'NimbusSanL Bold.ttf')))
self.width = 210 # 21 x 29,7cm
self.height = 297
self.nLeft = 10

Loading…
Cancel
Save