Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to python3 #10

Open
wants to merge 67 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
bd8bf13
Ran 2to3 without hand edits, trivial changes, some todos added
walcovanloon Jun 14, 2022
79e3989
Update pyftpdlib to a version that supports Python 3 (#6)
walcovanloon Jun 14, 2022
c2f16bd
#6 API updates and updated byte conversion in C extension
walcovanloon Jun 14, 2022
bb08048
#6 More stuff in ignore list
walcovanloon Jun 14, 2022
db8b461
#6 Format changes
walcovanloon Jun 14, 2022
bbdcf27
#6 Fix more byte string conversions
walcovanloon Jun 16, 2022
b0ea632
#6 I/O api update
walcovanloon Jun 16, 2022
87f101f
#6 2to3 changes (print statement and type updates)
walcovanloon Jun 16, 2022
9814359
#6 fix byte encoding and fix string conversions
walcovanloon Jun 17, 2022
6d21fc5
#6 fix byte encoding by an already fixed method in the sysex module
walcovanloon Jun 17, 2022
41c8cbe
#6 introduce byte literals; fix byte wise comparisons
walcovanloon Jun 17, 2022
88823af
#6 introduce byte literals; fix byte wise comparisons
walcovanloon Jun 17, 2022
c2a1c6a
#6 introduce byte literals
walcovanloon Jun 17, 2022
cb2d509
#6 replace StringIO with BytesIO
walcovanloon Jun 17, 2022
7013605
#6 disable FTP and OSC tests - they need library upgrade fixes/replac…
walcovanloon Jun 17, 2022
49d8de2
#6 introduce bytes literals
walcovanloon Jun 17, 2022
fca3445
#6 2to3 fixes
walcovanloon Jun 17, 2022
3291857
#6 introduce hello_world replacement for checkout script
walcovanloon Jun 17, 2022
4f64cdf
#6 add refactor TODO to prevent dependency on native library
walcovanloon Jun 17, 2022
9eb7254
#6 update docker image to python 3.9
walcovanloon Jun 17, 2022
68036ce
#6 fix mypy findings (whitespace, typing, python2 remnants)
walcovanloon Jun 17, 2022
f567e89
#6 fix mypy findings (duplicate methods)
walcovanloon Jun 17, 2022
ff80c3b
#6 byte literals for all sysex commands
walcovanloon Jun 18, 2022
5b777e3
#6 refactor transfer location into a python enum to reduce depedency …
walcovanloon Jun 18, 2022
103f10e
#6 assert types (could not get mypy to flag the issues)
walcovanloon Jun 18, 2022
095da3c
#6 fix test name
walcovanloon Jun 18, 2022
42d82f0
#6 Updated README.md to mention Python 3 support
walcovanloon Jun 25, 2022
375c548
#6 Formatting fixes
walcovanloon Jun 25, 2022
47f3474
#6 pyftpdlib, trivial API changes
walcovanloon Jun 25, 2022
9abe932
#6 pyftpdlib, fix API and tests
walcovanloon Jun 25, 2022
f19f974
#6 fix exception message and make it more helpful
walcovanloon Jun 25, 2022
404e4f0
#6 some fixes to allow FTP server to be started; FS not yet compatible
walcovanloon Jun 25, 2022
2937ef4
#6 some fixes to allow FTP server to be started; FS not yet compatible
walcovanloon Jun 25, 2022
25ca238
#6 fix ftp tests
walcovanloon Jun 25, 2022
71c98b4
#6 first aksui code changes to support pygobject
walcovanloon Jun 25, 2022
c7ae700
# 6 convert UI definitions to Glade 3 / GtkBuilder
Jun 25, 2022
e71de48
Merge branch 'upgradeToPython3' of https://github.com/watzo/aksy into…
walcovanloon Jun 25, 2022
0d108d0
#6 fix GtkBuilder validation errors
walcovanloon Jun 25, 2022
dae3ca1
#6 fix most glaring runtime errors - windows are shown
walcovanloon Jun 25, 2022
96c84c5
#6 fix API incompatibility
walcovanloon Jun 25, 2022
ffd2fda
#6 first attempt at Windows build
walcovanloon Jun 30, 2022
50fd9ad
#6 first attempt at Windows build - fix naming
walcovanloon Jun 30, 2022
a8b422d
#6 next attempt to install libusb
walcovanloon Jun 30, 2022
b4420fc
#6 next attempt to install libusb - fix conancenter reference
walcovanloon Jun 30, 2022
7d73391
#6 next attempt to install libusb - retry with revisions
walcovanloon Jun 30, 2022
7cb034d
#6 next attempt to install libusb - retry with revisions
walcovanloon Jun 30, 2022
d2480d6
#6 more attempts to install libusb - retry with revisions
walcovanloon Jun 30, 2022
40fd9a3
#6 attempt to copy libraries/includes into workspace and adjust setup…
walcovanloon Jun 30, 2022
c54547a
#6 include dirent headers; remove debug log
walcovanloon Jun 30, 2022
f9f404c
#6 fix windows path names
walcovanloon Jun 30, 2022
469fe82
#6 fix windows path name escapes
walcovanloon Jun 30, 2022
ec2477a
#6 fix library name inclusion
walcovanloon Jun 30, 2022
2147fc0
#6 build binaries for aksy-fs utility on mac and windows
walcovanloon Jul 2, 2022
c7db4d3
#6 build binaries for aksy-fs utility on mac and windows
walcovanloon Jul 2, 2022
c5f86e2
#6 build binaries for aksy-fs utility on mac and windows - fix yaml
walcovanloon Jul 2, 2022
2dee291
#6 build binaries for aksy-fs utility on mac and windows - attempt fi…
walcovanloon Jul 2, 2022
68e4570
#6 build binaries for aksy-fs utility on mac and windows - attempt fi…
walcovanloon Jul 2, 2022
6856b80
#6 build binaries for aksy-fs utility on mac and windows - fix nuitka…
walcovanloon Jul 2, 2022
1cd195f
#6 build binaries for aksy-fs utility on mac and windows - fix pip/py…
walcovanloon Jul 2, 2022
bfa6d1d
#6 build binaries for aksy-fs utility on mac and windows - fix conan
walcovanloon Jul 2, 2022
28463ac
#6 build binaries for aksy-fs utility on mac and windows - fix nuitka
walcovanloon Jul 2, 2022
a6ba251
#6 build binaries for aksy-fs utility on mac and windows - fix fuse-p…
walcovanloon Jul 2, 2022
60ef9be
#6 fix test run on macosx
walcovanloon Jul 3, 2022
beba035
#6 attempt to fix nuitka compilation on macosx; install zstandard for…
walcovanloon Jul 3, 2022
c913d5f
#6 attempt to fix nuitka compilation logging on macosx
walcovanloon Jul 3, 2022
3b39fed
#6 attempt to fix nuitka compilation logging on macosx (now an educa…
walcovanloon Jul 3, 2022
d1b6ce7
#6 attempt to fix nuitka compilation logging on macosx (now an educa…
walcovanloon Jul 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 65 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@ orbs:
# Orb commands and jobs help you with common scripting around a language/tool
# so you dont have to copy and paste it everywhere.
# See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/python
python: circleci/[email protected]
python: circleci/[email protected]
python-win: circleci/[email protected]

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
build-and-test: # This is the name of the job, feel free to change it to better match what you're trying to do!
build-and-test-linux:
# These next lines defines a Docker executors: https://circleci.com/docs/2.0/executor-types/
# You can specify an image from Dockerhub or use one of the convenience images from CircleCI's Developer Hub
# A list of available CircleCI Docker convenience images are available here: https://circleci.com/developer/images/image/cimg/python
# The executor is the environment in which the steps below will be executed - below will use a python 3.8 container
# Change the version below to your required version of python
docker:
- image: cimg/python:2.7.18
- image: cimg/python:3.9
# Checkout the code as the first step. This is a dedicated CircleCI step.
# The python orb's install-packages step will install the dependencies from a Pipfile via Pipenv by default.
# Here we're making sure we use just use the system-wide pip. By default it uses the project root's requirements.txt.
Expand All @@ -42,10 +43,66 @@ jobs:
# This assumes pytest is installed via the install-package step above
command: ./scripts/runtests.py

# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
build-and-test-windows:
executor:
name: python-win/default
steps:
- checkout
- run:
name: Get conan package manager and nuitka python compiler
command: pip install conan nuitka
- run:
name: Install libusb
command: |
$Env:CONAN_REVISIONS_ENABLED=1

conan install . -g deploy --install-folder build/nativelibs/ --remote conancenter
- run:
name: Build and install
command: python.exe setup.py install
- run:
name: Run tests
command: ./scripts/runtests.py
- run:
name: Package
command: python -m nuitka --assume-yes-for-downloads --standalone --onefile src/aksyfs/aksyfuse.py --output-dir=build/binaries/
- store_artifacts:
path: build/binaries


build-and-test-macosx:
macos:
xcode: 13.4.1
steps:
- checkout
- run:
name: Install python and libusb, fuse dependencies
command: brew install [email protected] macfuse libusb-compat pkg-config
- run:
name: Get conan package manager and nuitka python compiler
command: pip3.9 install conan nuitka zstandard ordered-set
- run:
name: Install libusb
command: |
export CONAN_REVISIONS_ENABLED=1

echo conan install . -g deploy --install-folder build/nativelibs/ --remote conancenter --build=libusb --build=libusb-compat
- run:
name: Build and install
command: python3.9 setup.py install
- run:
name: Run tests
command: python3.9 scripts/runtests.py
- run:
name: Package
command: python3.9 -m nuitka --no-progressbar --assume-yes-for-downloads --standalone --macos-create-app-bundle --onefile src/aksyfs/aksyfuse.py --output-dir=build/binaries
- store_artifacts:
path: build/binaries


workflows:
sample: # This is the name of the workflow, feel free to change it to better match your workflow.
# Inside the workflow, you define the jobs you want to run.
build-all:
jobs:
- build-and-test
- build-and-test-linux
- build-and-test-windows
- build-and-test-macosx
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ dist/*
build/*
buildenv/*
*.pyc
venv/
venv*/
.idea/
.DS_Store
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@ functionality (disk functions, transfers and a bunch of untested modules) of
the S56K.

With Aksui included from 0.3 and onwards, the original goal of Aksy comes in
site again. Stay tuned.
sight again.

And of 2017, this library seems to fulfill its promise: it still compiles and installs
And of 2022, this library starts to fulfill its promise: it still compiles and installs
on modern 64 bit systems, thanks to the stability of libusb and python.

Python 2.7 is now supported. Python 3 support is looked into.
## Python 3 support
### Ported modules
* aksy core library works
* aksy-fs, mounting the sampler's memory and filesystem on a MacOS/Linux host system, works

### Modules still to do
* aksy-ftpd, the FTP server which allows one to map the sampler's filesystem and memory as a Drive on Windows
* Aksui needs to be [ported from pygtk to pygobject](https://pygobject.readthedocs.io/en/latest/guide/porting.html)

## Usage

Expand Down
5 changes: 5 additions & 0 deletions conanfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[requires]
libusb-compat/0.1.7@#ab6a3c9ec4ddf4ca47e0960f694498c3

[generators]
deploy
57 changes: 0 additions & 57 deletions examples/checkout.py

This file was deleted.

15 changes: 15 additions & 0 deletions examples/hello_world.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from contextlib import closing

from aksy.device import Devices


def get_sampler_name():
with closing(Devices.get_instance('mock_z48', 'mock')) as z48:
print(f'hello {z48.systemtools.get_sampler_name()}!')

with closing(Devices.get_instance('z48', 'usb')) as z48:
print(f'hello real {z48.systemtools.get_sampler_name()}!')


if __name__ == "__main__":
get_sampler_name()
46 changes: 22 additions & 24 deletions scripts/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,9 @@
import os
import sys
import time
import types
import getopt
import unittest
import traceback
from sets import Set

__metaclass__ = type

Expand Down Expand Up @@ -169,7 +167,7 @@ def visit(ignored, dir, files):
results.append(path)
return
if '__init__.py' not in files:
print >> sys.stderr, "%s is not a package" % dir
print("%s is not a package" % dir, file=sys.stderr)
return
for file in files:
if file.startswith('test') and file.endswith('.py'):
Expand Down Expand Up @@ -226,7 +224,7 @@ def get_all_test_cases(module):
if not name.startswith('Test'):
continue
item = getattr(module, name)
if (isinstance(item, (type, types.ClassType)) and
if (isinstance(item, type) and
issubclass(item, unittest.TestCase)):
results.append(item)
return results
Expand All @@ -236,7 +234,7 @@ def get_test_classes_from_testsuite(suite):
"""Returns a set of test case classes used in a test suite."""
if not isinstance(suite, unittest.TestSuite):
raise TypeError('not a TestSuite', suite)
results = Set()
results = set()
for test in suite._tests:
if isinstance(test, unittest.TestCase):
results.add(test.__class__)
Expand All @@ -259,16 +257,16 @@ def get_test_cases(test_files, cfg, tracer=None):
if test_suite is None:
continue
if cfg.warn_omitted:
all_classes = Set(get_all_test_cases(module))
all_classes = set(get_all_test_cases(module))
classes_in_suite = get_test_classes_from_testsuite(test_suite)
difference = all_classes - classes_in_suite
for test_class in difference:
# surround the warning with blank lines, otherwise it tends
# to get lost in the noise
print >> sys.stderr
print >> sys.stderr, ("%s: WARNING: %s not in test suite"
% (file, test_class.__name__))
print >> sys.stderr
print(file=sys.stderr)
print(("%s: WARNING: %s not in test suite"
% (file, test_class.__name__)), file=sys.stderr)
print(file=sys.stderr)
if (cfg.level is not None and
getattr(test_suite, 'level', 0) > cfg.level):
continue
Expand All @@ -280,7 +278,7 @@ def get_test_cases(test_files, cfg, tracer=None):
def get_test_hooks(test_files, cfg, tracer=None):
"""Returns a list of test hooks from a given list of test modules."""
results = []
dirs = Set(map(os.path.dirname, test_files))
dirs = set(list(map(os.path.dirname, test_files)))
for dir in list(dirs):
if os.path.basename(dir) == 'ftests':
dirs.add(os.path.join(os.path.dirname(dir), 'tests'))
Expand Down Expand Up @@ -425,7 +423,7 @@ def run(self, test):
self.stream.writeln()
if not result.wasSuccessful():
self.stream.write("FAILED (")
failed, errored = map(len, (result.failures, result.errors))
failed, errored = list(map(len, (result.failures, result.errors)))
if failed:
self.stream.write("failures=%d" % failed)
if errored:
Expand All @@ -447,8 +445,8 @@ def main(argv):

# Environment
if sys.version_info < (2, 3):
print >> sys.stderr, '%s: need Python 2.3 or later' % argv[0]
print >> sys.stderr, 'your python is %s' % sys.version
print('%s: need Python 2.3 or later' % argv[0], file=sys.stderr)
print('your python is %s' % sys.version, file=sys.stderr)
return 1

# Defaults
Expand Down Expand Up @@ -476,7 +474,7 @@ def main(argv):
'level=', 'all-levels', 'coverage'])
for k, v in opts:
if k == '-h':
print __doc__
print(__doc__)
return 0
elif k == '-v':
cfg.verbosity += 1
Expand Down Expand Up @@ -509,22 +507,22 @@ def main(argv):
try:
cfg.level = int(v)
except ValueError:
print >> sys.stderr, '%s: invalid level: %s' % (argv[0], v)
print >> sys.stderr, 'run %s -h for help'
print('%s: invalid level: %s' % (argv[0], v), file=sys.stderr)
print('run %s -h for help', file=sys.stderr)
return 1
elif k == '--all-levels':
cfg.level = None
else:
print >> sys.stderr, '%s: invalid option: %s' % (argv[0], k)
print >> sys.stderr, 'run %s -h for help'
print('%s: invalid option: %s' % (argv[0], k), file=sys.stderr)
print('run %s -h for help', file=sys.stderr)
return 1
if args:
cfg.pathname_regex = args[0]
if len(args) > 1:
cfg.test_regex = args[1]
if len(args) > 2:
print >> sys.stderr, '%s: too many arguments: %s' % (argv[0], args[2])
print >> sys.stderr, 'run %s -h for help'
print('%s: too many arguments: %s' % (argv[0], args[2]), file=sys.stderr)
print('run %s -h for help', file=sys.stderr)
return 1
if not cfg.unit_tests and not cfg.functional_tests:
cfg.unit_tests = True
Expand Down Expand Up @@ -564,11 +562,11 @@ def main(argv):
success = True
if cfg.list_files:
baselen = len(cfg.basedir) + 1
print "\n".join([fn[baselen:] for fn in test_files])
print("\n".join([fn[baselen:] for fn in test_files]))
if cfg.list_tests:
print "\n".join([test.id() for test in test_cases])
print("\n".join([test.id() for test in test_cases]))
if cfg.list_hooks:
print "\n".join([str(hook) for hook in test_hooks])
print("\n".join([str(hook) for hook in test_hooks]))
if cfg.run_tests:
runner = CustomTestRunner(cfg, test_hooks)
suite = unittest.TestSuite()
Expand Down
Loading