From 94d0b9d0c4277966032aaae1ffabf5b949a4461b Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Fri, 19 Jul 2024 21:06:02 -0700 Subject: [PATCH] Rework code structure and metadata to be setuptools-friendly --- LICENSE | 19 +++++++++++++++++++ MANIFEST.in | 7 +++++++ README | 2 +- pyproject.toml | 29 +++++++++++++++++++++++++++++ src/Ophis/CmdLine.py | 2 +- src/Ophis/CorePragmas.py | 2 +- src/Ophis/Environment.py | 2 +- src/Ophis/Errors.py | 2 +- src/Ophis/Frontend.py | 2 +- src/Ophis/IR.py | 2 +- src/Ophis/Listing.py | 2 +- src/Ophis/Macro.py | 2 +- src/Ophis/Main.py | 6 +----- src/Ophis/Opcodes.py | 2 +- src/Ophis/Passes.py | 2 +- src/Ophis/__init__.py | 8 +++++++- src/setup.py | 16 ---------------- src/tools/opcodes/gensets.py | 2 +- 18 files changed, 75 insertions(+), 34 deletions(-) create mode 100644 LICENSE create mode 100644 MANIFEST.in create mode 100644 pyproject.toml delete mode 100644 src/setup.py diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ab8787f --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Ophis, Copyright (C) 2002-2024 Michael Martin and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..558d310 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,7 @@ +include tests/*.oph +include tests/*.bin +include tests/*.py +include tests/sub/*.oph +include tests/sub/sub/*.oph +graft examples +graft platform diff --git a/README b/README index d593385..8a500f4 100644 --- a/README +++ b/README @@ -11,7 +11,7 @@ It is provided under the MIT license, reproduced below: --- -Ophis, Copyright (C) 2002-2014 Michael Martin and contributors +Ophis, Copyright (C) 2002-2024 Michael Martin and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b4eae9e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,29 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "ophis-asm" +version = "2.2.0" +authors = [ + { name="Michael Martin", email="mcmartin@gmail.com" }, +] +description = "A cross-assembler for the 6502 series of chips" +readme = "README" +requires-python = ">=3.6" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "Topic :: Software Development :: Assemblers" +] +dependencies = [] + +[project.scripts] +ophis = "Ophis:ophis_argv" + +[tool.setuptools.package-dir] +Ophis = "src/Ophis" diff --git a/src/Ophis/CmdLine.py b/src/Ophis/CmdLine.py index f3b8586..ec3760c 100644 --- a/src/Ophis/CmdLine.py +++ b/src/Ophis/CmdLine.py @@ -2,7 +2,7 @@ import optparse -# Copyright 2002-2014 Michael C. Martin and additional contributors. +# Copyright 2002-2024 Michael C. Martin and additional contributors. # You may use, modify, and distribute this file under the MIT # license: See README for details. diff --git a/src/Ophis/CorePragmas.py b/src/Ophis/CorePragmas.py index d0cd96e..d66fc38 100644 --- a/src/Ophis/CorePragmas.py +++ b/src/Ophis/CorePragmas.py @@ -2,7 +2,7 @@ Provides the core assembler directives.""" -# Copyright 2002-2014 Michael C. Martin and additional contributors. +# Copyright 2002-2024 Michael C. Martin and additional contributors. # You may use, modify, and distribute this file under the MIT # license: See README for details. diff --git a/src/Ophis/Environment.py b/src/Ophis/Environment.py index 7d7546d..4a4d4d8 100644 --- a/src/Ophis/Environment.py +++ b/src/Ophis/Environment.py @@ -3,7 +3,7 @@ Implements the symbol lookup, through nested environments - any non-temporary variable is stored at the top level.""" -# Copyright 2002-2014 Michael C. Martin and additional contributors. +# Copyright 2002-2024 Michael C. Martin and additional contributors. # You may use, modify, and distribute this file under the MIT # license: See README for details. diff --git a/src/Ophis/Errors.py b/src/Ophis/Errors.py index 2704ec0..15b763d 100644 --- a/src/Ophis/Errors.py +++ b/src/Ophis/Errors.py @@ -3,7 +3,7 @@ Keeps track of the number of errors inflicted so far, and where in the assembly the errors are occurring.""" -# Copyright 2002-2014 Michael C. Martin and additional contributors. +# Copyright 2002-2024 Michael C. Martin and additional contributors. # You may use, modify, and distribute this file under the MIT # license: See README for details. diff --git a/src/Ophis/Frontend.py b/src/Ophis/Frontend.py index f2bd503..0793d0d 100644 --- a/src/Ophis/Frontend.py +++ b/src/Ophis/Frontend.py @@ -10,7 +10,7 @@ import sys import os import os.path -# Copyright 2002-2014 Michael C. Martin and additional contributors. +# Copyright 2002-2024 Michael C. Martin and additional contributors. # You may use, modify, and distribute this file under the MIT # license: See README for details. diff --git a/src/Ophis/IR.py b/src/Ophis/IR.py index a71fd36..3383179 100644 --- a/src/Ophis/IR.py +++ b/src/Ophis/IR.py @@ -3,7 +3,7 @@ Classes for representing the Intermediate nodes upon which the assembler passes operate.""" -# Copyright 2002-2014 Michael C. Martin and additional contributors. +# Copyright 2002-2024 Michael C. Martin and additional contributors. # You may use, modify, and distribute this file under the MIT # license: See README for details. diff --git a/src/Ophis/Listing.py b/src/Ophis/Listing.py index 186e2eb..e525188 100644 --- a/src/Ophis/Listing.py +++ b/src/Ophis/Listing.py @@ -4,7 +4,7 @@ traditional to mix binary with reconstructed instructions that have all arguments precomputed. This class manages that.""" -# Copyright 2002-2014 Michael C. Martin and additional contributors. +# Copyright 2002-2024 Michael C. Martin and additional contributors. # You may use, modify, and distribute this file under the MIT # license: See README for details. diff --git a/src/Ophis/Macro.py b/src/Ophis/Macro.py index aeea97c..3cdb5df 100644 --- a/src/Ophis/Macro.py +++ b/src/Ophis/Macro.py @@ -4,7 +4,7 @@ set via .alias commands and prevented from escaping with .scope and .scend commands.""" -# Copyright 2002-2014 Michael C. Martin and additional contributors. +# Copyright 2002-2024 Michael C. Martin and additional contributors. # You may use, modify, and distribute this file under the MIT # license: See README for details. diff --git a/src/Ophis/Main.py b/src/Ophis/Main.py index f1f8c2d..bae9635 100644 --- a/src/Ophis/Main.py +++ b/src/Ophis/Main.py @@ -3,7 +3,7 @@ When invoked as main, interprets its command line and goes from there. Otherwise, use run_ophis(cmdline-list) to use it inside a script.""" -# Copyright 2002-2014 Michael C. Martin and additional contributors. +# Copyright 2002-2024 Michael C. Martin and additional contributors. # You may use, modify, and distribute this file under the MIT # license: See README for details. @@ -109,7 +109,3 @@ def run_ophis(args): Ophis.CorePragmas.reset() return run_all() - - -if __name__ == '__main__': - sys.exit(run_ophis(sys.argv[1:])) diff --git a/src/Ophis/Opcodes.py b/src/Ophis/Opcodes.py index 598f2ef..4bb0cbf 100644 --- a/src/Ophis/Opcodes.py +++ b/src/Ophis/Opcodes.py @@ -3,7 +3,7 @@ Tables for the assembly of 6502-family instructions, mapping opcodes and addressing modes to binary instructions.""" -# Copyright 2002-2014 Michael C. Martin and additional contributors. +# Copyright 2002-2024 Michael C. Martin and additional contributors. # You may use, modify, and distribute this file under the MIT # license: See README for details. diff --git a/src/Ophis/Passes.py b/src/Ophis/Passes.py index 8ef5292..7000e87 100644 --- a/src/Ophis/Passes.py +++ b/src/Ophis/Passes.py @@ -7,7 +7,7 @@ very extensible; additional analyses or optimizations may be added as new subclasses of Pass.""" -# Copyright 2002-2014 Michael C. Martin and additional contributors. +# Copyright 2002-2024 Michael C. Martin and additional contributors. # You may use, modify, and distribute this file under the MIT # license: See README for details. diff --git a/src/Ophis/__init__.py b/src/Ophis/__init__.py index d29c4c7..00fb76d 100644 --- a/src/Ophis/__init__.py +++ b/src/Ophis/__init__.py @@ -1,5 +1,11 @@ "Ophis - a cross-assembler for the 6502 series of chips" -# Copyright 2002-2014 Michael C. Martin and additional contributors. +# Copyright 2002-2024 Michael C. Martin and additional contributors. # You may use, modify, and distribute this file under the MIT # license: See README for details. + +import sys +import Ophis.Main + +def ophis_argv(): + sys.exit(Ophis.Main.run_ophis(sys.argv[1:])) diff --git a/src/setup.py b/src/setup.py deleted file mode 100644 index 75f43fd..0000000 --- a/src/setup.py +++ /dev/null @@ -1,16 +0,0 @@ -from distutils.core import setup -setup(name='Ophis', - version='2.1', - description='A cross-assembler for the 6502 series of processors', - url='https://github.com/michaelcmartin/Ophis', - author="Michael Martin", - author_email="mcmartin@gmail.com", - license="MIT", - long_description="Ophis is a cross-assembler for the 65xx series of " - "chips. It supports the stock 6502 opcodes, the 65c02 " - "extensions, and syntax for the \"undocumented " - "opcodes\" in the 6510 chip used on the Commodore 64. " - "(Syntax for these opcodes matches those given in the " - "VICE team's documentation.)", - packages=['Ophis'], - scripts=['scripts/ophis']) diff --git a/src/tools/opcodes/gensets.py b/src/tools/opcodes/gensets.py index a779f8c..5119352 100755 --- a/src/tools/opcodes/gensets.py +++ b/src/tools/opcodes/gensets.py @@ -8,7 +8,7 @@ prologue = '"""' + """Opcodes file. Tables for the assembly of 6502-family instructions, mapping opcodes and addressing modes to binary instructions.""" + '"""' + """ -# Copyright 2002-2014 Michael C. Martin and additional contributors. +# Copyright 2002-2024 Michael C. Martin and additional contributors. # You may use, modify, and distribute this file under the MIT # license: See README for details.