From 28490230cf68f8045fc63a8c7d3de19c7c1d3bcd Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sat, 3 Aug 2013 16:10:52 -0500 Subject: [PATCH 1/2] make a basic python module --- dump_sections => bin/dump_sections | 0 pokemontools/__init__.py | 1 + chars.py => pokemontools/chars.py | 0 comparator.py => pokemontools/comparator.py | 0 crystal.py => pokemontools/crystal.py | 0 .../disassemble_map_scripts.py | 0 .../dump_sections.py | 0 gbz80disasm.py => pokemontools/gbz80disasm.py | 0 gfx.py => pokemontools/gfx.py | 0 graph.py => pokemontools/graph.py | 0 .../interval_map.py | 0 .../item_constants.py | 0 labels.py => pokemontools/labels.py | 0 map_names.py => pokemontools/map_names.py | 0 .../move_constants.py | 0 .../old_parse_scripts.py | 0 .../overworldripper.py | 0 .../parse_consecutive_strings.py | 0 pksv.py => pokemontools/pksv.py | 0 pointers.py => pokemontools/pointers.py | 0 .../pokemon_constants.py | 0 romstr.py => pokemontools/romstr.py | 0 sym.py => pokemontools/sym.py | 0 trainers.py => pokemontools/trainers.py | 0 .../type_constants.py | 0 wram.py => pokemontools/wram.py | 0 setup.py | 44 +++++++++++++++++++ .../test_dump_sections.py | 0 tests.py => tests/tests.py | 0 29 files changed, 45 insertions(+) rename dump_sections => bin/dump_sections (100%) create mode 100644 pokemontools/__init__.py rename chars.py => pokemontools/chars.py (100%) rename comparator.py => pokemontools/comparator.py (100%) rename crystal.py => pokemontools/crystal.py (100%) rename disassemble_map_scripts.py => pokemontools/disassemble_map_scripts.py (100%) rename dump_sections.py => pokemontools/dump_sections.py (100%) rename gbz80disasm.py => pokemontools/gbz80disasm.py (100%) rename gfx.py => pokemontools/gfx.py (100%) rename graph.py => pokemontools/graph.py (100%) rename interval_map.py => pokemontools/interval_map.py (100%) rename item_constants.py => pokemontools/item_constants.py (100%) rename labels.py => pokemontools/labels.py (100%) rename map_names.py => pokemontools/map_names.py (100%) rename move_constants.py => pokemontools/move_constants.py (100%) rename old_parse_scripts.py => pokemontools/old_parse_scripts.py (100%) rename overworldripper.py => pokemontools/overworldripper.py (100%) rename parse_consecutive_strings.py => pokemontools/parse_consecutive_strings.py (100%) rename pksv.py => pokemontools/pksv.py (100%) rename pointers.py => pokemontools/pointers.py (100%) rename pokemon_constants.py => pokemontools/pokemon_constants.py (100%) rename romstr.py => pokemontools/romstr.py (100%) rename sym.py => pokemontools/sym.py (100%) rename trainers.py => pokemontools/trainers.py (100%) rename type_constants.py => pokemontools/type_constants.py (100%) rename wram.py => pokemontools/wram.py (100%) create mode 100644 setup.py rename test_dump_sections.py => tests/test_dump_sections.py (100%) rename tests.py => tests/tests.py (100%) diff --git a/dump_sections b/bin/dump_sections similarity index 100% rename from dump_sections rename to bin/dump_sections diff --git a/pokemontools/__init__.py b/pokemontools/__init__.py new file mode 100644 index 0000000..833709b --- /dev/null +++ b/pokemontools/__init__.py @@ -0,0 +1 @@ +import crystal diff --git a/chars.py b/pokemontools/chars.py similarity index 100% rename from chars.py rename to pokemontools/chars.py diff --git a/comparator.py b/pokemontools/comparator.py similarity index 100% rename from comparator.py rename to pokemontools/comparator.py diff --git a/crystal.py b/pokemontools/crystal.py similarity index 100% rename from crystal.py rename to pokemontools/crystal.py diff --git a/disassemble_map_scripts.py b/pokemontools/disassemble_map_scripts.py similarity index 100% rename from disassemble_map_scripts.py rename to pokemontools/disassemble_map_scripts.py diff --git a/dump_sections.py b/pokemontools/dump_sections.py similarity index 100% rename from dump_sections.py rename to pokemontools/dump_sections.py diff --git a/gbz80disasm.py b/pokemontools/gbz80disasm.py similarity index 100% rename from gbz80disasm.py rename to pokemontools/gbz80disasm.py diff --git a/gfx.py b/pokemontools/gfx.py similarity index 100% rename from gfx.py rename to pokemontools/gfx.py diff --git a/graph.py b/pokemontools/graph.py similarity index 100% rename from graph.py rename to pokemontools/graph.py diff --git a/interval_map.py b/pokemontools/interval_map.py similarity index 100% rename from interval_map.py rename to pokemontools/interval_map.py diff --git a/item_constants.py b/pokemontools/item_constants.py similarity index 100% rename from item_constants.py rename to pokemontools/item_constants.py diff --git a/labels.py b/pokemontools/labels.py similarity index 100% rename from labels.py rename to pokemontools/labels.py diff --git a/map_names.py b/pokemontools/map_names.py similarity index 100% rename from map_names.py rename to pokemontools/map_names.py diff --git a/move_constants.py b/pokemontools/move_constants.py similarity index 100% rename from move_constants.py rename to pokemontools/move_constants.py diff --git a/old_parse_scripts.py b/pokemontools/old_parse_scripts.py similarity index 100% rename from old_parse_scripts.py rename to pokemontools/old_parse_scripts.py diff --git a/overworldripper.py b/pokemontools/overworldripper.py similarity index 100% rename from overworldripper.py rename to pokemontools/overworldripper.py diff --git a/parse_consecutive_strings.py b/pokemontools/parse_consecutive_strings.py similarity index 100% rename from parse_consecutive_strings.py rename to pokemontools/parse_consecutive_strings.py diff --git a/pksv.py b/pokemontools/pksv.py similarity index 100% rename from pksv.py rename to pokemontools/pksv.py diff --git a/pointers.py b/pokemontools/pointers.py similarity index 100% rename from pointers.py rename to pokemontools/pointers.py diff --git a/pokemon_constants.py b/pokemontools/pokemon_constants.py similarity index 100% rename from pokemon_constants.py rename to pokemontools/pokemon_constants.py diff --git a/romstr.py b/pokemontools/romstr.py similarity index 100% rename from romstr.py rename to pokemontools/romstr.py diff --git a/sym.py b/pokemontools/sym.py similarity index 100% rename from sym.py rename to pokemontools/sym.py diff --git a/trainers.py b/pokemontools/trainers.py similarity index 100% rename from trainers.py rename to pokemontools/trainers.py diff --git a/type_constants.py b/pokemontools/type_constants.py similarity index 100% rename from type_constants.py rename to pokemontools/type_constants.py diff --git a/wram.py b/pokemontools/wram.py similarity index 100% rename from wram.py rename to pokemontools/wram.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..c5f45bb --- /dev/null +++ b/setup.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +import sys + +try: + from setuptools import setup +except ImportError: + from distutils.core import setup + +# for uploading to pypi +if sys.argv[-1] == 'publish': + os.system('python setup.py sdist upload') + sys.exit() + +# There's some intersection with requirements.txt but pypi can't handle git +# dependencies. +requires = [ + "mock", +] + +setup( + name="pokemontools", + version="1.0", + description="Tools for compiling and disassembling Pokémon Red and Pokémon Crystal.", + long_description=open("README.md", "r").read(), + license="BSD", + author="Bryan Bishop", + author_email="kanzure@gmail.com", + url="https://github.com/kanzure/pokemon-reverse-engineering-tools", + packages=["pokemontools"], + package_dir={"pokemontools": "pokemontools"}, + include_package_data=True, + install_requires=requires, + platforms="any", + classifiers=[ + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Topic :: Software Development :: Libraries :: Python Modules", + "Programming Language :: Python", + "Programming Language :: Python :: 2.7", + ] +) diff --git a/test_dump_sections.py b/tests/test_dump_sections.py similarity index 100% rename from test_dump_sections.py rename to tests/test_dump_sections.py diff --git a/tests.py b/tests/tests.py similarity index 100% rename from tests.py rename to tests/tests.py From a76acbadd2571c0d73b0797b2b68e205ab882b64 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sat, 3 Aug 2013 16:12:54 -0500 Subject: [PATCH 2/2] fix import lines in tests/ --- tests/test_dump_sections.py | 2 +- tests/tests.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/test_dump_sections.py b/tests/test_dump_sections.py index b73b86f..e32e60d 100644 --- a/tests/test_dump_sections.py +++ b/tests/test_dump_sections.py @@ -10,7 +10,7 @@ if not hasattr(unittest.TestCase, 'setUpClass'): sys.stderr.write("The unittest2 module or Python 2.7 is required to run this script.") sys.exit(1) -from dump_sections import ( +from pokemontools.dump_sections import ( upper_hex, format_bank_number, calculate_bank_quantity, diff --git a/tests/tests.py b/tests/tests.py index 227071f..606c105 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -8,38 +8,38 @@ import hashlib import random import json -from interval_map import IntervalMap -from chars import chars, jap_chars +from pokemontools.interval_map import IntervalMap +from pokemontools.chars import chars, jap_chars -from romstr import ( +from pokemontools.romstr import ( RomStr, AsmList, ) -from item_constants import ( +from pokemontools.item_constants import ( item_constants, find_item_label_by_id, generate_item_constants, ) -from pointers import ( +from pokemontools.pointers import ( calculate_bank, calculate_pointer, ) -from pksv import ( +from pokemontools.pksv import ( pksv_gs, pksv_crystal, ) -from labels import ( +from pokemontools.labels import ( remove_quoted_text, line_has_comment_address, line_has_label, get_label_from_line, ) -from crystal import ( +from pokemontools.crystal import ( rom, load_rom, rom_until,