Skip to content

Commit

Permalink
Merge pull request #10 from kattni/pypi
Browse files Browse the repository at this point in the history
PyPi setup.
  • Loading branch information
brennen authored Aug 7, 2018
2 parents ef2beef + cf7e728 commit f4fed44
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 24 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
*.mpy
.idea
__pycache__
_build
*.pyc
*.mpy
.env
build*
bundles
*.DS_Store
.eggs
dist
**/*.egg-info
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ ignored-classes=optparse.Values,thread._local,_thread._local
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=
ignored-modules=board

# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
Expand Down
38 changes: 19 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
# This is a common .travis.yml for generating library release zip files for
# CircuitPython library releases using circuitpython-build-tools.
# See https://github.com/adafruit/circuitpython-build-tools for detailed setup
# instructions.

dist: trusty
sudo: false
language: python
python:
- "3.6"

- '3.6'
cache:
pip: true

pip: true
deploy:
provider: releases
api_key: $GITHUB_TOKEN
- provider: releases
api_key: "$GITHUB_TOKEN"
file_glob: true
file: $TRAVIS_BUILD_DIR/bundles/*
file: "$TRAVIS_BUILD_DIR/bundles/*"
skip_cleanup: true
overwrite: true
on:
tags: true

- provider: pypi
user: adafruit-travis
on:
tags: true
password:
secure: f3THVFaLhKUStaYcrl2KQxXf/60ucgQ/UmK5jmKtRqjduWc1hHBi3hepyOAwqvcSW1TLD0rBxW6Y+Ny1dgv0XMv3kVzfa6u/7YCvRC1jaHiJrLqNu//HiX3ExM3phiptnH9yYD4dp3QvaVviB6Fxal3iLs4NwHhpHis/7Ky3QpywX7CPxOka9U4pSjsNLtSZbPDdZKJnHzAyk9crG+NxHWeuWQB/3tUFKOT5AfYY4aJ+uzmFxK7ykleAZsOG1Kmt770Pua8zqN5O2DcbVOScQ32eviLJJSPzEHSOmtQkqE5BjImPXmWEMzcHgSmOuwL5rTfWAVAiIbJY5eYtT6CJAV2ttRMuDJnTaZ/mnOCWHDJqDVNgWihxyYvaN/Sra/nkURziW8+ROOR9pSfL0CZOdEFWUoHMuKiJ/RFF4W0pXji9y4tqYm5xUUSkEfb6MTPtYu16mm+nPSsX2jJOryVdGhWZo3JYgj4AK61G91ilHtfhbLveWWZvg8S+oKrf2xddHBfE8XxyGhM1108AGximwXMM8lEqEKYE7gV7hIP5hLTE4iwW4Ckbib7ERS9X0Z1o7uenHb54Q+gb3kTcSPtEdSyeJgMqTI+Hq0rz5VO8dd0QQX6ybCQxcHOF9yPPVca4ekaTwiY+vxV+s31E8sKJVhETD91TVqvT7PGq2oKEHyI=
install:
- pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme

- pip install -r requirements.txt
- pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme
- pip install --force-reinstall pylint==1.9.2
script:
- pylint adafruit_sdcard.py
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-sd --library_location .
- cd docs && sphinx-build -E -W -b html . _build/html
- pylint adafruit_sdcard.py
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-sd --library_location
.
- cd docs && sphinx-build -E -W -b html . _build/html && cd ..
8 changes: 7 additions & 1 deletion adafruit_sdcard.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ def _wait_for_ready(self, spi, timeout=0.3):
while time.monotonic() - start_time < timeout and self._single_byte[0] != 0xff:
spi.readinto(self._single_byte, write_value=0xff)

#pylint: disable-msg=too-many-arguments
# pylint: disable-msg=too-many-arguments
# pylint: disable=no-member
# no-member disable should be reconsidered when it can be tested
def _cmd(self, cmd, arg=0, crc=0, response_buf=None, data_block=True, wait=True):
"""
Issue a command to the card and read an optional data response.
Expand Down Expand Up @@ -294,6 +296,8 @@ def _block_cmd(self, cmd, block, crc, response_buf=None):
result = buf[0]
break

# pylint: disable=singleton-comparison
# Disable should be removed when refactor can be tested.
if response_buf != None and result == 0:
self._readinto(response_buf)

Expand Down Expand Up @@ -362,6 +366,8 @@ def _write(self, token, buf, start=0, end=None):
spi.write(cmd, end=2)

# check the response
# pylint: disable=no-else-return
# Disable should be removed when refactor can be tested
for _ in range(_CMD_TIMEOUT):
spi.readinto(cmd, end=1, write_value=0xff)
if not (cmd[0] & 0x80):
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
]


autodoc_mock_imports = ["adafruit_bus_device", "micropython"]
# autodoc_mock_imports = ["adafruit_bus_device", "micropython"]

intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),
'BusDevice': ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
adafruit-circuitpython-bus-device
Adafruit-Blinka
adafruit-circuitpython-busdevice
61 changes: 61 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""

# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path

here = path.abspath(path.dirname(__file__))

# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()

setup(
name='adafruit-circuitpython-sd',

use_scm_version=True,
setup_requires=['setuptools_scm'],

description='CircuitPython library for SD cards.',
long_description=long_description,
long_description_content_type='text/x-rst',

# The project's main homepage.
url='https://github.com/adafruit/Adafruit_CircuitPython_SD',

# Author details
author='Adafruit Industries',
author_email='[email protected]',

install_requires=['Adafruit-Blinka', 'adafruit-circuitpython-busdevice'],

# Choose your license
license='MIT',

# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries',
'Topic :: System :: Hardware',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
],

# What does your project relate to?
keywords='adafruit sdcard sd card mount storage featherwing adalogger'
'breakout hardware micropython circuitpython',

# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
py_modules=['adafruit_sdcard'],
)

0 comments on commit f4fed44

Please sign in to comment.