~thestr4ng3r/mymcplus

600289da7d91387ceadf59f88e67cf30dfdd2ef3 — Florian Märkl 3 years ago 585c5eb
Make packages, Add setup.py
M .gitignore => .gitignore +3 -0
@@ 3,3 3,6 @@
.idea/
.pytest_cache/
/test/data/
build/
dist/
*.egg-info/

A mymc/__init__.py => mymc/__init__.py +2 -0
@@ 0,0 1,2 @@

__all__ = ["gui", "lzari", "mymc", "ps2mc", "ps2mc_dir", "ps2mc_ecc", "ps2save", "round", "sjistab", "verbuild"]
\ No newline at end of file

A mymc/__main__.py => mymc/__main__.py +7 -0
@@ 0,0 1,7 @@

import sys

from . import mymc

if __name__ == "__main__":
    sys.exit(mymc.main(sys.argv))
\ No newline at end of file

A mymc/gui/__init__.py => mymc/gui/__init__.py +2 -0
@@ 0,0 1,2 @@

__all__ = ["dirlist_control", "gui", "icon_window", "resources", "utils"]
\ No newline at end of file

M mymc/gui/dirlist_control.py => mymc/gui/dirlist_control.py +3 -3
@@ 1,10 1,10 @@

import wx

import ps2mc
import ps2save
from .. import ps2mc
from .. import ps2save

from gui import utils
from . import utils


def get_dialog_units(win):

M mymc/gui/gui.py => mymc/gui/gui.py +5 -6
@@ 19,12 19,11 @@ if os.name == "nt" and hasattr(sys, "setdefaultencoding"):
    sys.setdefaultencoding("mbcs")
import wx

import ps2mc
import ps2save
from gui import resources
from gui.icon_window import IconWindow
from gui.dirlist_control import DirListControl
from gui import utils
from .. import ps2mc
from .. import ps2save
from .icon_window import IconWindow
from .dirlist_control import DirListControl
from . import utils


class GuiConfig(wx.Config):

M mymc/gui/utils.py => mymc/gui/utils.py +1 -1
@@ 3,7 3,7 @@ import io
import wx
import struct

from gui import resources
from . import resources

def single_title(title):
    """Convert the two parts of an icon.sys title into one string."""

M mymc/mymc.py => mymc/mymc.py +6 -8
@@ 15,10 15,10 @@ import optparse
import textwrap
from errno import EEXIST, EIO

import ps2mc
import ps2save
from ps2mc_dir import *
import verbuild
from . import ps2mc
from . import ps2save
from .ps2mc_dir import *
from . import verbuild

class subopt_error(Exception):
    pass


@@ 449,7 449,7 @@ def do_gui(cmd, mcname, opts, args, opterr):
        opterr("Incorrect number of arguments.")

    #try:
    from gui import gui
    from .gui import gui
    #except ImportError:
    #    write_error(None, "GUI not available")
    #    return 1


@@ 698,7 698,7 @@ class my_help_formatter(optparse.IndentedHelpFormatter):
            lines.append(line)
        return "\n".join(lines) + "\n"

def main(argv):
def main(argv=sys.argv):
    prog = argv[0]
    usage = "usage: %prog [-ih] memcard.ps2 command [...]"
    description = ("Manipulate PS2 memory card images.\n\n"


@@ 807,6 807,4 @@ def main(argv):

    return ret

if __name__ == "__main__":
    sys.exit(main(sys.argv))


M mymc/ps2mc.py => mymc/ps2mc.py +4 -4
@@ 17,10 17,10 @@ from errno import EACCES, ENOENT, EEXIST, ENOTDIR, EISDIR, EROFS, ENOTEMPTY,\
import fnmatch
import traceback

from round import *
from ps2mc_ecc import *
from ps2mc_dir import *
import ps2save
from .round import *
from .ps2mc_ecc import *
from .ps2mc_dir import *
from . import ps2save

PS2MC_MAGIC = b"Sony PS2 Memory Card Format "
PS2MC_FAT_ALLOCATED_BIT = 0x80000000

M mymc/ps2mc_ecc.py => mymc/ps2mc_ecc.py +1 -1
@@ 14,7 14,7 @@ _SCCS_ID = "@(#) mysc ps2mc_ecc.py 1.4 07/12/17 02:34:04\n"

import array

from round import div_round_up
from .round import div_round_up

try:
    import ctypes

M mymc/ps2save.py => mymc/ps2save.py +5 -8
@@ 17,14 17,11 @@ import binascii
import array
import zlib

from round import div_round_up, round_up
from ps2mc_dir import *
from sjistab import shift_jis_normalize_table

try:
    import lzari
except ImportError:
    lzari = None
from .round import div_round_up, round_up
from .ps2mc_dir import *
from .sjistab import shift_jis_normalize_table

from . import lzari

PS2SAVE_MAX_MAGIC = b"Ps2PowerSave"
PS2SAVE_SPS_MAGIC = b"\x0d\0\0\0SharkPortSave"

M mymc/verbuild.py => mymc/verbuild.py +2 -2
@@ 1,2 1,2 @@
MYMC_VERSION_BUILD = r'''6'''
MYMC_VERSION_MAJOR = r'''2'''
MYMC_VERSION_BUILD = r'''0'''
MYMC_VERSION_MAJOR = r'''3'''

A setup.py => setup.py +16 -0
@@ 0,0 1,16 @@

from setuptools import setup

setup(
    name="mymc-plus",
    version="3.0",
    packages=["mymc"],
    entry_points={
        "console_scripts": [
            "mymc-plus = mymc.mymc:main"
        ]
    },
    install_requires=[
        "wxPython" # TODO: make optional
    ]
)
\ No newline at end of file

M test/conftest.py => test/conftest.py +1 -1
@@ 5,7 5,7 @@ import tarfile
import shutil

test_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.abspath(os.path.join(test_dir, "..", "mymc")))
sys.path.append(os.path.abspath(os.path.join(test_dir, "..")))

@pytest.fixture(scope="session")
def data(tmpdir_factory):

M test/test_lzari.py => test/test_lzari.py +1 -1
@@ 1,6 1,6 @@

import lzari
import array
from mymc import lzari


def bits_to_str(bits):

M test/test_memorycard.py => test/test_memorycard.py +11 -11
@@ 1,5 1,5 @@

import mymc
from mymc import mymc


def md5(fn):


@@ 49,7 49,7 @@ def test_extract(capsys, data, tmpdir):


def test_add(monkeypatch, capsys, mc01_copy, tmpdir):
    import ps2mc
    from mymc import ps2mc
    patch_fixed_time(monkeypatch, ps2mc)
    patch_localtime(monkeypatch)



@@ 184,7 184,7 @@ def test_dir(capsys, data):


def test_format(monkeypatch, capsys, tmpdir):
    import ps2mc
    from mymc import ps2mc
    patch_fixed_time(monkeypatch, ps2mc)

    mc_file = tmpdir.join("mc.ps2").strpath


@@ 201,7 201,7 @@ def test_format(monkeypatch, capsys, tmpdir):


def test_mkdir(monkeypatch, capsys, mc01_copy):
    import ps2mc
    from mymc import ps2mc
    patch_fixed_time(monkeypatch, ps2mc)

    mc_file = mc01_copy.join("mc01.ps2").strpath


@@ 271,7 271,7 @@ def test_export_max(capsys, data, tmpdir):


def test_import_psu(monkeypatch, capsys, data, mc02_copy):
    import ps2mc
    from mymc import ps2mc
    patch_fixed_time(monkeypatch, ps2mc)

    mc_file = mc02_copy.join("mc02.ps2").strpath


@@ 289,8 289,8 @@ def test_import_psu(monkeypatch, capsys, data, mc02_copy):


def test_import_max(monkeypatch, capsys, data, mc02_copy):
    import ps2mc
    import ps2save
    from mymc import ps2mc
    from mymc import ps2save
    patch_fixed_time(monkeypatch, ps2mc)
    patch_fixed_time(monkeypatch, ps2save)



@@ 308,7 308,7 @@ def test_import_max(monkeypatch, capsys, data, mc02_copy):


def test_import_sps(monkeypatch, capsys, data, mc02_copy):
    import ps2mc
    from mymc import ps2mc
    patch_fixed_time(monkeypatch, ps2mc)

    mc_file = mc02_copy.join("mc02.ps2").strpath


@@ 326,7 326,7 @@ def test_import_sps(monkeypatch, capsys, data, mc02_copy):


def test_import_xps(monkeypatch, capsys, data, mc02_copy):
    import ps2mc
    from mymc import ps2mc
    patch_fixed_time(monkeypatch, ps2mc)

    mc_file = mc02_copy.join("mc02.ps2").strpath


@@ 344,8 344,8 @@ def test_import_xps(monkeypatch, capsys, data, mc02_copy):


def test_import_cbs(monkeypatch, capsys, data, mc02_copy):
    import ps2mc
    import ps2save
    from mymc import ps2mc
    from mymc import ps2save
    patch_fixed_time(monkeypatch, ps2mc)
    patch_fixed_time(monkeypatch, ps2save)