-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from SaltieRL/rattletrapdownload
Rattletrapdownload
- Loading branch information
Showing
16 changed files
with
190 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,7 @@ exclude_lines = | |
if __name__ == .__main__.: | ||
omit = | ||
tests/* | ||
carball/tests/* | ||
utils/tests/* | ||
init.py | ||
setup.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ venv/ | |
output | ||
.env | ||
.coverage | ||
rattletrap* | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import inspect | ||
import os | ||
import fnmatch | ||
from typing import List, Union | ||
|
||
|
||
def get_rattletrap_path() -> Union[bytes, str]: | ||
filename = inspect.getframeinfo(inspect.currentframe()).filename | ||
path = os.path.dirname(os.path.abspath(filename)) | ||
return path | ||
|
||
|
||
def get_rattletrap_binaries(path: Union[bytes, str]) -> List[Union[bytes, str]]: | ||
files = os.listdir(path) | ||
binaries = [f for f in files if not f.endswith('.py') and fnmatch.fnmatch(f, "*rattletrap*")] | ||
print(binaries) | ||
return binaries | ||
|
||
|
||
def download_rattletrap(): | ||
from carball.rattletrap.check_rattletrap_version import update_rattletrap | ||
update_rattletrap() | ||
|
||
|
||
def get_binary_for_platform(platform, binaries): | ||
if platform == 'Windows': | ||
binary = [f for f in binaries if f.endswith('.exe')][0] | ||
elif platform == 'Linux': | ||
binary = [f for f in binaries if 'linux' in f][0] | ||
elif platform == 'Darwin': | ||
binary = [f for f in binaries if 'osx' in f][0] | ||
else: | ||
raise Exception('Unknown platform, unable to process replay file.') | ||
return binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import os | ||
import unittest | ||
|
||
from carball.rattletrap.rattletrap_utils import get_rattletrap_binaries, get_rattletrap_path, download_rattletrap | ||
from carball.rattletrap.run_rattletrap import create_rattletrap_command | ||
from carball.rattletrap.check_rattletrap_version import update_rattletrap | ||
|
||
|
||
class setup_tests(unittest.TestCase): | ||
|
||
def cleanup(self): | ||
path = get_rattletrap_path() | ||
binaries = get_rattletrap_binaries(get_rattletrap_path()) | ||
|
||
# clean out existing | ||
for binary in binaries: | ||
os.remove(os.path.join(path, binary)) | ||
|
||
def test_rattle(self): | ||
self.cleanup() | ||
|
||
download_rattletrap() | ||
|
||
def test_create_rattletrap_command(self): | ||
self.cleanup() | ||
|
||
create_rattletrap_command('file.replay', 'outputdir') | ||
|
||
# check post download | ||
create_rattletrap_command('file.replay', 'outputdir2') | ||
|
||
def test_direct_check_version(self): | ||
self.cleanup() | ||
update_rattletrap() | ||
|
||
#skip update | ||
update_rattletrap() | ||
|
||
def test_get_correct_version_from_platform(self): | ||
path = get_rattletrap_path() | ||
binaries = get_rattletrap_binaries(get_rattletrap_path()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
from utils.create_proto import create_proto_files | ||
from utils.import_fixer import convert_to_relative_imports | ||
def initalize_rattletrap(): | ||
from carball.rattletrap.check_rattletrap_version import update_rattletrap | ||
try: | ||
update_rattletrap() | ||
except e: | ||
print('Issue adding rattletrap') | ||
|
||
|
||
if __name__ == "__main__": | ||
def initialize_project(): | ||
from utils.create_proto import create_proto_files | ||
from utils.import_fixer import convert_to_relative_imports | ||
|
||
create_proto_files() | ||
convert_to_relative_imports() | ||
initalize_rattletrap() | ||
|
||
if __name__ == "__main__": | ||
initialize_project() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
|
||
import setuptools | ||
from setuptools import setup | ||
from setuptools.command.develop import develop | ||
from setuptools.command.install import install | ||
import os | ||
|
||
with open(os.path.join('carball', 'analysis', 'PROTOBUF_VERSION'), 'r') as f: | ||
|
@@ -16,6 +18,24 @@ | |
else: | ||
long_description = '' | ||
|
||
|
||
class PostDevelopCommand(develop): | ||
"""Post-installation for development mode.""" | ||
def run(self): | ||
from init import initialize_project | ||
initialize_project() | ||
# this needs to be last | ||
develop.run(self) | ||
|
||
class PostInstallCommand(install): | ||
"""Post-installation for installation mode.""" | ||
def run(self): | ||
from init import initialize_project | ||
initialize_project() | ||
# this needs to be last | ||
install.run(self) | ||
|
||
|
||
setup( | ||
name='carball', | ||
version=version_string, | ||
|
@@ -29,5 +49,9 @@ | |
author_email='[email protected]', | ||
description='Rocket League replay parsing and analysis.', | ||
long_description=long_description, | ||
exclude_package_data={'': ['.gitignore', '.git/*', '.git/**/*', 'replays/*']} | ||
exclude_package_data={'': ['.gitignore', '.git/*', '.git/**/*', 'replays/*']}, | ||
cmdclass={ | ||
'develop': PostDevelopCommand, | ||
'install': PostInstallCommand, | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters