Skip to content

Mac #28

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

Open
wants to merge 14 commits into
base: mac
Choose a base branch
from
Open

Mac #28

Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ project_root_marker

/.vim_l

/.idea

*.pyc

*.csproj.user
Expand Down
2 changes: 1 addition & 1 deletion Projeny.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ PathVars:

# Note that these are defaults, and can be overridden in any other Projeny.yaml file
MsBuildExePath: 'C:/Windows/Microsoft.NET/Framework/v4.0.30319/msbuild.exe'
UnityExePath: 'C:/Program Files/Unity/Editor/Unity.exe'
UnityExePath: '/Applications/Unity/Unity.app'

Console:
UseColors: False
Expand Down
5 changes: 5 additions & 0 deletions Source/bin/PrjEditorApi
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cd ./..

command -v python3 >/dev/null 2>&1 || { echo -e >&2 "I require python 3.x but it's not installed.\nPlease install Python 3.x before running Projeny.\nAborting."; exit 1; }

python3 -m prj.main.EditorApi "$@"
9 changes: 9 additions & 0 deletions Source/bin/prj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

dir=$(pwd)

cd $(dirname "$0")/..

command -v /usr/local/bin/python3 >/dev/null 2>&1 || { echo -e >&2 "I require python 3.x but it's not installed.\nPlease install Python 3.x before running Projeny.\nAborting."; exit 1; }

/usr/local/bin/python3 -m prj.main.Prj $dir "$@"
7 changes: 0 additions & 7 deletions Source/mtm/config/Config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@

import yaml

import mtm.util.Util as Util

from mtm.util.Assert import *
import mtm.ioc.Container as Container
from mtm.ioc.Inject import Inject
from mtm.ioc.Inject import InjectOptional
import mtm.ioc.IocAssertions as Assertions

from collections import OrderedDict

Expand Down
84 changes: 0 additions & 84 deletions Source/mtm/log/ColorConsole.py

This file was deleted.

39 changes: 4 additions & 35 deletions Source/mtm/log/LogStreamConsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import shutil

from mtm.util.Assert import *
import mtm.log.ColorConsole as ColorConsole

class AnsiiCodes:
BLACK = "\033[1;30m"
Expand Down Expand Up @@ -49,9 +48,7 @@ def __init__(self, verbose, veryVerbose):
self._initColors()

def _initColors(self):
self._defaultColors = ColorConsole.get_text_attr()
self._defaultBg = self._defaultColors & 0x0070
self._defaultFg = self._defaultColors & 0x0007
print("Colors are not working at the moment on mac.")

def log(self, logType, message):

Expand Down Expand Up @@ -92,38 +89,10 @@ def _getHeadingIndent(self):
return self._log.getCurrentNumHeadings() * " "

def _output(self, logType, message, stream, useColors):

stream.write('\n')

stream.write(self._getHeadingIndent())

if not useColors or logType == LogType.Info:
stream.write(message)
stream.flush()
else:
ColorConsole.set_text_attr(self._getColorAttrs(logType))
stream.write(message)
stream.flush()
ColorConsole.set_text_attr(self._defaultColors)

def _getColorAttrs(self, logType):
if logType == LogType.HeadingStart:
return ColorConsole.FOREGROUND_CYAN | self._defaultBg | ColorConsole.FOREGROUND_INTENSITY

if logType == LogType.HeadingEnd:
return ColorConsole.FOREGROUND_BLACK | self._defaultBg | ColorConsole.FOREGROUND_INTENSITY

if logType == LogType.Good:
return ColorConsole.FOREGROUND_GREEN | self._defaultBg | ColorConsole.FOREGROUND_INTENSITY

if logType == LogType.Warn:
return ColorConsole.FOREGROUND_YELLOW | self._defaultBg | ColorConsole.FOREGROUND_INTENSITY

if logType == LogType.Error:
return ColorConsole.FOREGROUND_RED | self._defaultBg | ColorConsole.FOREGROUND_INTENSITY

assertThat(logType == LogType.Debug or logType == LogType.Noise)
return ColorConsole.FOREGROUND_BLACK | self._defaultBg | ColorConsole.FOREGROUND_INTENSITY
stream.write(message)
stream.write('\n')
stream.flush()



Expand Down
24 changes: 15 additions & 9 deletions Source/mtm/log/LogWatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import os
import signal
import threading
import msvcrt
import tty
import termios #unix only


class LogWatcher:
def __init__(self, logPath, logFunc):
Expand Down Expand Up @@ -82,15 +84,19 @@ def onLog(logStr):
log.start()

while 1:
if msvcrt.kbhit():
key = msvcrt.getch().decode('UTF-8')

if ord(key) == 27:
sys.exit()

if key == 'c':
os.system('cls')
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(1)
finally:
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
if ord(ch) == 27:
sys.exit(1)
elif ch == 'c':
exec('clear')

time.sleep(0.1)


log.stop()
15 changes: 10 additions & 5 deletions Source/mtm/util/JunctionHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import mtm.ioc.Container as Container
from mtm.ioc.Inject import Inject
from mtm.util.SystemHelper import ProcessErrorCodeException
import mtm.ioc.IocAssertions as Assertions
import mtm.util.JunctionUtil as JunctionUtil

Expand All @@ -23,7 +24,7 @@ def removeJunction(self, linkDir):
if os.path.isdir(linkDir) and JunctionUtil.islink(linkDir):
try:
# Use rmdir not python unlink to ensure we don't delete the link source
self._sys.executeShellCommand('rmdir "{0}"'.format(linkDir))
self._sys.executeShellCommand('rm -r "{0}"'.format(linkDir))
except Exception as e:
raise Exception('Failed while attempting to delete junction "{0}":\n{1}'.format(linkDir, str(e))) from e

Expand All @@ -35,13 +36,17 @@ def makeJunction(self, actualPath, linkPath):
actualPath = self._varMgr.expandPath(actualPath)
linkPath = self._varMgr.expandPath(linkPath)

assertThat(self._sys.directoryExists(actualPath))
#if os.path.exists(actualPath):
# self._sys.executeShellCommand("rm -r {0}".format(actualPath))
if os.path.exists(linkPath):
self._sys.executeShellCommand('rm -r "{0}"'.format(linkPath))

self._sys.makeMissingDirectoriesInPath(linkPath)
assertThat(not self._sys.directoryExists(linkPath), "These locations should not exist: {0}".format(linkPath))

self._log.debug('Making junction with actual path ({0}) and new link path ({1})'.format(linkPath, actualPath))
self._log.debug('Making symlink with actual path ({0}) and new link path ({1})'.format(linkPath, actualPath))
# Note: mklink is a shell command and can't be executed otherwise
self._sys.executeShellCommand('mklink /J "{0}" "{1}"'.format(linkPath, actualPath))

self._sys.executeShellCommand('ln -s "{0}" "{1}"'.format(actualPath, linkPath))

def removeJunctionsInDirectory(self, dirPath, recursive):
fullDirPath = self._varMgr.expandPath(dirPath)
Expand Down
Loading