Skip to content

Commit

Permalink
Updated Windows executable builder script.
Browse files Browse the repository at this point in the history
  • Loading branch information
imiolek-ireneusz committed Aug 22, 2022
1 parent 70bc20b commit 79f165a
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion eduactiv82exe.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(self):
# Auhor of program
self.author_name = "Ireneusz Imiolek"
self.author_email = "[email protected]"
self.copyright = "Copyright (c) 2012-2019 Ireneusz Imiolek"
self.copyright = "Copyright (c) 2012-2022 Ireneusz Imiolek"

# Description
self.project_description = "eduActiv8 - Educational Activities for Kids"
Expand All @@ -94,6 +94,13 @@ def __init__(self):

# python scripts (strings) to be included, seperated by a comma
self.extra_scripts = []
lst = self.find_extra_scripts("i18n", '*.py')
# change backlash into a module dot notation
self.extra_scripts = []
for each in lst:
if each[-3:] == ".py":
each = each.replace("\\", ".").replace(".py", "")
self.extra_scripts.append(each)

# Zip file name (None will bundle files in exe instead of zip file)
self.zipfile_name = None
Expand Down Expand Up @@ -135,6 +142,34 @@ def walk_helper(arg, dirname, files):
[os.path.basename(f) for f in glob.glob(self.opj(srcdir, '*'))])
return file_list

def find_extra_scripts(self, srcdir, *wildcards, **kw):
# get a list of all files under the srcdir matching wildcards,
# returned in a format to be used for install_data
def walk_helper(arg, dirname, files):
if '.svn' in dirname:
return
names = []
lst, wildcards = arg
for wc in wildcards:
wc_name = self.opj(dirname, wc)
for f in files:
filename = self.opj(dirname, f)

if fnmatch.fnmatch(filename, wc_name) and not os.path.isdir(filename):
names.append(filename)
if names:
lst.extend(names)

file_list = []
recursive = kw.get('recursive', True)
if recursive:
os.path.walk(srcdir, walk_helper, (file_list, wildcards))
else:
walk_helper((file_list, wildcards),
srcdir,
[os.path.basename(f) for f in glob.glob(self.opj(srcdir, '*'))])
return file_list

def run(self):
if os.path.isdir(self.dist_dir): # Erase previous destination dir
shutil.rmtree(self.dist_dir)
Expand Down

0 comments on commit 79f165a

Please sign in to comment.