Skip to content
Permalink
Browse files

Merge pull request #106 from Pyfa-fit/development

2017.05.27
  • Loading branch information...
Ebag333 committed May 30, 2017
2 parents c468f61 + 27d59cc commit 2ab231d92b95eb947096eb3ecc279471ea4b4f25
Showing 2,072 changed files with 6,310 additions and 6,251 deletions.
@@ -2,6 +2,8 @@ version: 1.0.{build}

# Do not build feature branch with open Pull Requests
skip_branch_with_pr: true
max_jobs: 3
shallow_clone: true

# scripts that are called at very beginning, before repo cloning
init:
@@ -155,6 +157,12 @@ install:
- "pip install -r requirements_build.txt"

build_script:

- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }

# Build the compiled extension
# - "python setup.py build"
- ECHO "Build pyfa:"
@@ -170,23 +178,22 @@ build_script:
build: on

after_build:
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }

- ps: "ls \".\\dist\\pyfa\\\""
# Zip
# APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER
#- 7z a build.zip -r C:\projects\pyfa\build\pyfa\*.*
- if [%PYTHON_ARCH%]==[32] (
7z a Pyfa_Windows.zip -r .\dist\pyfa\*.*)
- if [%PYTHON_ARCH%]==[64] (
7z a Pyfa_Windows_x64.zip -r .\dist\pyfa\*.*)
7z a Pyfa_Windows_x64.zip -r .\dist\pyfa\*.* -mx=9)

- if [%PYTHON_ARCH%]==[32] (
7z a pyfa_windows_debug.zip -r .\dist\pyfa_debug\*.*)


- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
7z a pyfa_windows_debug.zip -r .\dist\pyfa_debug\*.* -mx=9)

- ps: if ($env:PYTHON_ARCH -eq 32){
Push-AppveyorArtifact Pyfa_Windows.zip;
@@ -14,7 +14,6 @@
*.py3 text eol=crlf
*.pyw text eol=crlf
*.pyx text eol=crlf
pyfa.py text eol=lf

# Denote all files that are truly binary and should not be modified.
# Binary files
@@ -1,8 +1,8 @@
# pyfa.fit

_Master_: [![Build Status](https://travis-ci.org/Pyfa-fit/Pyfa.svg?branch=master)](https://travis-ci.org/pyfa-fit/Pyfa) [![Build Status](https://ci.appveyor.com/api/projects/status/6o0qe49yajcg7hyy/branch/master?svg=true)](https://ci.appveyor.com/project/Ebag333/pyfa-nr5qw/branch/master) [![codecov](https://codecov.io/gh/Pyfa-fit/Pyfa-fit/branch/master/graph/badge.svg)](https://codecov.io/gh/Pyfa-fit/Pyfa) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/86ace8fc05c24ae59b61e0223f7d161b)](https://www.codacy.com/app/Ebag333/Pyfa-fit?utm_source=github.com&utm_medium=referral&utm_content=Pyfa-fit/Pyfa-fit&utm_campaign=Badge_Grade)
_Master_: [![Build Status](https://api.travis-ci.org/Pyfa-fit/Pyfa-fit.svg?branch=master)](https://travis-ci.org/Pyfa-fit/Pyfa-fit) [![Build Status](https://ci.appveyor.com/api/projects/status/6o0qe49yajcg7hyy/branch/master?svg=true)](https://ci.appveyor.com/project/Ebag333/pyfa-nr5qw/branch/master) [![codecov](https://codecov.io/gh/Pyfa-fit/Pyfa-fit/branch/master/graph/badge.svg)](https://codecov.io/gh/Pyfa-fit/Pyfa-fit) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/86ace8fc05c24ae59b61e0223f7d161b)](https://www.codacy.com/app/Ebag333/Pyfa-fit?utm_source=github.com&utm_medium=referral&utm_content=Pyfa-fit/Pyfa-fit&utm_campaign=Badge_Grade)

_Development_: [![Build Status](https://travis-ci.org/Pyfa-fit/Pyfa.svg?branch=development)](https://travis-ci.org/pyfa-fit/Pyfa) [![Build Status](https://ci.appveyor.com/api/projects/status/6o0qe49yajcg7hyy/branch/development?svg=true)](https://ci.appveyor.com/project/Ebag333/pyfa-nr5qw/branch/development) [![codecov](https://codecov.io/gh/Pyfa-fit/Pyfa-fit/branch/development/graph/badge.svg)](https://codecov.io/gh/Pyfa-fit/Pyfa)
_Development_: [![Build Status](https://travis-ci.org/Pyfa-fit/Pyfa-fit.svg?branch=development)](https://travis-ci.org/Pyfa-fit/Pyfa-fit) [![Build Status](https://ci.appveyor.com/api/projects/status/6o0qe49yajcg7hyy/branch/development?svg=true)](https://ci.appveyor.com/project/Ebag333/pyfa-nr5qw/branch/development) [![codecov](https://codecov.io/gh/Pyfa-fit/Pyfa-fit/branch/development/graph/badge.svg)](https://codecov.io/gh/Pyfa-fit/Pyfa-fit)

![pyfa](/imgs/mainframe.png "Pyfa")
## What is it?
@@ -16,7 +16,7 @@ The latest version along with release notes can always be found on the project's
Development releases will have newer features, and may not function correctly. Use at your own risk.
_*Release Downloads*_:
[Current Release](https://github.com/Pyfa-fit/Pyfa/releases)
[Current Release](https://github.com/Pyfa-fit/Pyfa-fit/releases)
### Development Downloads
@@ -64,3 +64,15 @@ def HeronFit(DB, Gamedata, Saveddata):
fit.modules.append(mod)

return fit


# noinspection PyShadowingNames
@pytest.fixture # noqa: F811
def GnosisFit(DB, Gamedata, Saveddata):
print("Creating Gnosis")
item = DB['gamedata_session'].query(Gamedata['Item']).filter(Gamedata['Item'].name == "Gnosis").first()
ship = Saveddata['Ship'](item)
# setup fit
fit = Saveddata['Fit'](ship, "Gnosis Fit")

return fit
@@ -10,3 +10,27 @@ def StrongBluePillBooster(DB, Gamedata, Saveddata):
print("Creating Strong Blue Pill Booster")
item = DB['gamedata_session'].query(Gamedata['Item']).filter(Gamedata['Item'].name == "Strong Blue Pill Booster").first()
return Saveddata['Booster'](item)


# noinspection PyShadowingNames
@pytest.fixture # noqa: F811
def DamageControlII(DB, Gamedata, Saveddata):
print("Creating Damage Control II")
item = DB['gamedata_session'].query(Gamedata['Item']).filter(Gamedata['Item'].name == "Damage Control II").first()
return Saveddata['Module'](item)


# noinspection PyShadowingNames
@pytest.fixture # noqa: F811
def ExperimentalEnergizedAdaptiveNanoMembraneI(DB, Gamedata, Saveddata):
print("Creating Experimental Energized Adaptive Nano Membrane I")
item = DB['gamedata_session'].query(Gamedata['Item']).filter(Gamedata['Item'].name == "Experimental Energized Adaptive Nano Membrane I").first()
return Saveddata['Module'](item)


# noinspection PyShadowingNames
@pytest.fixture # noqa: F811
def EnergizedAdaptiveNanoMembraneI(DB, Gamedata, Saveddata):
print("Creating Energized Adaptive Nano Membrane I")
item = DB['gamedata_session'].query(Gamedata['Item']).filter(Gamedata['Item'].name == "Energized Adaptive Nano Membrane I").first()
return Saveddata['Module'](item)
@@ -74,25 +74,25 @@
}


def GetPath(root, file=None, codec=None):
def GetPath(root, filename=None, codec=None):
# Replace this with the function we actually use for this
path = os.path.realpath(os.path.abspath(root))

if file:
path = os.path.join(path, file)
if filename:
path = os.path.join(path, filename)

if codec:
path = path.decode(codec)

return path


def GetUnicodePath(root, file=None, codec=None):
def GetUnicodePath(root, filename=None, codec=None):
# Replace this with the function we actually use for this
path = os.path.realpath(os.path.abspath(root))

if file:
path = os.path.join(path, file)
if filename:
path = os.path.join(path, filename)

if codec:
path = unicode(path, codec)
@@ -25,7 +25,7 @@
saveInRoot = False

# Version data
version = "2017.05.21"
version = "2017.05.27"
if hasattr(sys, 'frozen'):
tag = ""
else:
@@ -48,7 +48,7 @@ a = Analysis(
hiddenimports=import_these,
hookspath=[],
runtime_hooks=[],
excludes=['FixTk', 'tcl', 'tk', '_tkinter', 'tkinter', 'Tkinter', 'pytz', 'numpy', 'numpy-atlas'],
excludes=['FixTk', 'tcl', 'tk', '_tkinter', 'tkinter', 'Tkinter', 'pytz'],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
@@ -14,14 +14,15 @@
gamedata_connectionstring = 'sqlite:///' + realpath(join(dirname(abspath(__file__)), u"..", u"eve.db"))
pyfalog.debug("Gamedata connection string: {0}", gamedata_connectionstring)

if istravis is True or hasattr(sys, '_called_from_test'):
# Running in Travis. Run saveddata database in memory.
saveddata_connectionstring = 'sqlite:///:memory:'

try:
saveddata_connectionstring
if istravis is True or hasattr(sys, '_called_from_test'):
# Running in Travis. Run saveddata database in memory.
saveddata_connectionstring = 'sqlite:///:memory:'
else:
# Only set this if it hasn't been set elsewhere
saveddata_connectionstring = 'sqlite:///' + realpath(join(dirname(abspath(__file__)), u"..", u"saveddata", u"saveddata.db"))
except NameError:
# Only set this if it hasn't been set elsewhere
saveddata_connectionstring = 'sqlite:///' + realpath(join(dirname(abspath(__file__)), u"..", u"saveddata", u"saveddata.db"))

pyfalog.debug("Saveddata connection string: {0}", saveddata_connectionstring)
@@ -31,7 +31,7 @@
configVal = getattr(eos.config, "gamedataCache", None)
if configVal is True:
def cachedQuery(amount, *keywords):
def deco(function):
def deco(_function):
def checkAndReturn(*args, **kwargs):
useCache = kwargs.pop("useCache", True)
cacheKey = []
@@ -42,7 +42,7 @@ def checkAndReturn(*args, **kwargs):
cacheKey = tuple(cacheKey)
handler = cache.get(cacheKey)
if handler is None or not useCache:
handler = cache[cacheKey] = function(*args, **kwargs)
handler = cache[cacheKey] = _function(*args, **kwargs)

return handler

@@ -54,9 +54,9 @@ def checkAndReturn(*args, **kwargs):
cachedQuery = eos.config.gamedataCache
else:
def cachedQuery(amount, *keywords):
def deco(function):
def deco(_function):
def checkAndReturn(*args, **kwargs):
return function(*args, **kwargs)
return _function(*args, **kwargs)

return checkAndReturn

@@ -83,11 +83,11 @@ def getItem(lookfor, eager=None):
item = gamedata_session.query(Item).options(*processEager(eager)).filter(Item.ID == lookfor).first()
elif isinstance(lookfor, basestring):
if lookfor in itemNameMap:
id = itemNameMap[lookfor]
_id = itemNameMap[lookfor]
if eager is None:
item = gamedata_session.query(Item).get(id)
item = gamedata_session.query(Item).get(_id)
else:
item = gamedata_session.query(Item).options(*processEager(eager)).filter(Item.ID == id).first()
item = gamedata_session.query(Item).options(*processEager(eager)).filter(Item.ID == _id).first()
else:
# Item names are unique, so we can use first() instead of one()
item = gamedata_session.query(Item).options(*processEager(eager)).filter(Item.name == lookfor).first()
@@ -157,11 +157,11 @@ def getGroup(lookfor, eager=None):
group = gamedata_session.query(Group).options(*processEager(eager)).filter(Group.ID == lookfor).first()
elif isinstance(lookfor, basestring):
if lookfor in groupNameMap:
id = groupNameMap[lookfor]
_id = groupNameMap[lookfor]
if eager is None:
group = gamedata_session.query(Group).get(id)
group = gamedata_session.query(Group).get(_id)
else:
group = gamedata_session.query(Group).options(*processEager(eager)).filter(Group.ID == id).first()
group = gamedata_session.query(Group).options(*processEager(eager)).filter(Group.ID == _id).first()
else:
# Group names are unique, so we can use first() instead of one()
group = gamedata_session.query(Group).options(*processEager(eager)).filter(Group.name == lookfor).first()
@@ -184,12 +184,12 @@ def getCategory(lookfor, eager=None):
Category.ID == lookfor).first()
elif isinstance(lookfor, basestring):
if lookfor in categoryNameMap:
id = categoryNameMap[lookfor]
_id = categoryNameMap[lookfor]
if eager is None:
category = gamedata_session.query(Category).get(id)
category = gamedata_session.query(Category).get(_id)
else:
category = gamedata_session.query(Category).options(*processEager(eager)).filter(
Category.ID == id).first()
Category.ID == _id).first()
else:
# Category names are unique, so we can use first() instead of one()
category = gamedata_session.query(Category).options(*processEager(eager)).filter(
@@ -213,12 +213,12 @@ def getMetaGroup(lookfor, eager=None):
MetaGroup.ID == lookfor).first()
elif isinstance(lookfor, basestring):
if lookfor in metaGroupNameMap:
id = metaGroupNameMap[lookfor]
_id = metaGroupNameMap[lookfor]
if eager is None:
metaGroup = gamedata_session.query(MetaGroup).get(id)
metaGroup = gamedata_session.query(MetaGroup).get(_id)
else:
metaGroup = gamedata_session.query(MetaGroup).options(*processEager(eager)).filter(
MetaGroup.ID == id).first()
MetaGroup.ID == _id).first()
else:
# MetaGroup names are unique, so we can use first() instead of one()
metaGroup = gamedata_session.query(MetaGroup).options(*processEager(eager)).filter(
@@ -252,31 +252,31 @@ def getAllMarketGroups(eager=None):


@cachedQuery(2, "where", "filter")
def getItemsByCategory(filter, where=None, eager=None):
if isinstance(filter, int):
filter = Category.ID == filter
elif isinstance(filter, basestring):
filter = Category.name == filter
def getItemsByCategory(_filter, where=None, eager=None):
if isinstance(_filter, int):
_filter = Category.ID == _filter
elif isinstance(_filter, basestring):
_filter = Category.name == _filter
else:
raise TypeError("Need integer or string as argument")

filter = processWhere(filter, where)
_filter = processWhere(_filter, where)
return gamedata_session.query(Item).options(*processEager(eager)).join(Item.group, Group.category).filter(
filter).all()
_filter).all()


@cachedQuery(3, "where", "nameLike", "join")
def searchItems(nameLike, where=None, join=None, eager=None, result_limit=150):
def searchItems(nameLike, where=None, _join=None, eager=None, result_limit=150):
if not isinstance(nameLike, basestring):
raise TypeError("Need string as argument")

if join is None:
join = tuple()
if _join is None:
_join = tuple()

if not hasattr(join, "__iter__"):
join = (join,)
if not hasattr(_join, "__iter__"):
_join = (_join,)

items = gamedata_session.query(Item).options(*processEager(eager)).join(*join)
items = gamedata_session.query(Item).options(*processEager(eager)).join(*_join)
for token in nameLike.split(' '):
token_safe = u"%{0}%".format(sqlizeString(token))
if where is not None:
@@ -313,33 +313,33 @@ def getVariations(itemids, groupIDs=None, where=None, eager=None):
return []

itemfilter = or_(*(metatypes_table.c.parentTypeID == itemid for itemid in itemids))
filter = processWhere(itemfilter, where)
_filter = processWhere(itemfilter, where)
joinon = items_table.c.typeID == metatypes_table.c.typeID
vars = gamedata_session.query(Item).options(*processEager(eager)).join((metatypes_table, joinon)).filter(
filter).all()
_vars = gamedata_session.query(Item).options(*processEager(eager)).join((metatypes_table, joinon)).filter(
_filter).all()

if vars:
return vars
if _vars:
return _vars
elif groupIDs:
itemfilter = or_(*(groups_table.c.groupID == groupID for groupID in groupIDs))
filter = processWhere(itemfilter, where)
_filter = processWhere(itemfilter, where)
joinon = items_table.c.groupID == groups_table.c.groupID
vars = gamedata_session.query(Item).options(*processEager(eager)).join((groups_table, joinon)).filter(
filter).all()
_vars = gamedata_session.query(Item).options(*processEager(eager)).join((groups_table, joinon)).filter(
_filter).all()

return vars
return _vars


@cachedQuery(1, "attr")
def getAttributeInfo(attr, eager=None):
if isinstance(attr, basestring):
filter = AttributeInfo.name == attr
_filter = AttributeInfo.name == attr
elif isinstance(attr, int):
filter = AttributeInfo.ID == attr
_filter = AttributeInfo.ID == attr
else:
raise TypeError("Need integer or string as argument")
try:
result = gamedata_session.query(AttributeInfo).options(*processEager(eager)).filter(filter).one()
result = gamedata_session.query(AttributeInfo).options(*processEager(eager)).filter(_filter).one()
except exc.NoResultFound:
result = None
return result
@@ -91,8 +91,8 @@ def upgrade(saveddata_engine):
saveddata_engine.execute("ALTER TABLE fits ADD COLUMN targetResistsID INTEGER;")

# Convert modules
for replacement_item, list in CONVERSIONS.iteritems():
for retired_item in list:
for replacement_item, _list in CONVERSIONS.iteritems():
for retired_item in _list:
saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?',
(replacement_item, retired_item))
saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?',

0 comments on commit 2ab231d

Please sign in to comment.
You can’t perform that action at this time.