Пример #1
0
def pypi():
    CompileHelp('helptxt')
    subprocess.call(['python', 'manage.py', 'collectstatic', '--noinput'])

    installDir = 'RaceDB'

    zfname = os.path.join('install', 'RaceDB-Install-{}.zip'.format(version))
    zf = zipfile.ZipFile(zfname, 'w')

    # Write all important source files to the install zip.
    suffixes = {
        'py',
        'txt',
        'md',
        'html',
        'css',
        'js',
        'png',
        'gif',
        'jpg',
        'ico',
        'json',
        'xls',
        'xlsx',
        'gz',
        'ttf',
        'bash',
    }
    for root, dirs, files in os.walk('.'):
        for f in files:

            # Don't include local configuration in the install.
            if f in ('time_zone.py', 'DatabaseConfig.py', 'RaceDB.json',
                     'AllowedHosts.py', 'FixJsonImport.py'):
                print('****************************************')
                print('skipping: {}'.format(f))
                print('****************************************')
                continue

            fname = os.path.join(root, f)
            if 'racedb' in fname.lower() and fname.lower().endswith('.json'):
                continue
            if any(d in fname for d in [
                    'EV', 'GFRR', 'usac_heatmap', 'usac_bug', 'test_data',
                    'migrations_old', "bugs"
            ]):
                continue
            if os.path.splitext(fname)[1][1:] in suffixes:
                print('writing: {}'.format(fname))
                zf.write(fname, os.path.join(installDir, fname))

    zf.write('../../CrossMgr/CrossMgrImpinj/pyllrp/pypi/dist/' + pyllrp,
             os.path.join(installDir, pyllrp))
    zf.close()

    gds = [
        r"c:\GoogleDrive\Downloads\All Platforms",
        r"C:\Users\edwar\Google Drive\Downloads\All Platforms",
        r"C:\Users\Edward Sitarski\Google Drive\Downloads\All Platforms",
    ]
    for googleDrive in gds:
        if os.path.exists(googleDrive):
            break
    googleDrive = os.path.join(googleDrive, 'RaceDB')

    for root, dirs, files in os.walk(googleDrive):
        for f in files:
            fname = os.path.join(root, f)
            if (os.path.splitext(fname)[1] == '.zip'
                    and os.path.basename(fname) != os.path.basename(zfname)
                    and not any(officialRelease in fname
                                for officialRelease in officialReleases)):
                print('removing: {}'.format(fname))
                os.remove(fname)

    for fname in [zfname, 'Install-Readme.txt', 'RaceDB-3-Upgrade.txt']:
        print('releasing: {}'.format(fname))
        shutil.copy(fname, googleDrive)
Пример #2
0
                lineOut.append(c)
        lines.append(''.join(lineOut))
    return '\n'.join(lines) + '\n'


def writeToFile(s, fname):
    print 'creating', fname, '...'
    with open(os.path.join(pypiDir, fname), 'wb') as f:
        f.write(s)


#-----------------------------------------------------------------------
# Compile the help files
#
from helptxt.compile import CompileHelp
CompileHelp('helptxt')

# Index the help files.
from HelpIndex import BuildHelpIndex
BuildHelpIndex()

#------------------------------------------------------
# Create a release area for pypi
print 'Clearing previous contents...'
try:
    subprocess.call(['rm', '-rf', pypiDir])
except:
    try:
        shutil.rmtree(pypiDir, ignore_errors=True)
    except:
        pass
Пример #3
0
def buildRaceDB(releasedir):
    try:
        virtenv = os.environ['VIRTUAL_ENV']
    except:
        print("Refusing to build outside the virtual env")
        sys.exit(1)
    print("Building version: {}".format(version))
    from helptxt.compile import CompileHelp
    CompileHelp('helptxt')
    subprocess.call(['python3', 'manage.py', 'collectstatic', '--noinput'])

    installDir = 'RaceDB'

    if not os.path.exists(releasedir):
        os.mkdir(releasedir)

    tfname = os.path.join(releasedir,
                          'RaceDB-Install-{}.tar.xz'.format(version))
    zfname = os.path.join(releasedir, 'RaceDB-Install-{}.zip'.format(version))
    if os.path.exists(tfname):
        os.remove(tfname)
    if os.path.exists(zfname):
        os.remove(zfname)

    tf = tarfile.open(tfname, 'w:xz')
    zf = zipfile.ZipFile(zfname, 'w')

    # Write all important source files to the install zip.
    suffixes = {
        'py',
        'txt',
        'md',
        'html',
        'css',
        'js',
        'png',
        'gif',
        'jpg',
        'ico',
        'json',
        'xls',
        'xlsx',
        'gz',
        'ttf',
        'bash',
    }
    for root, dirs, files in os.walk('.'):
        for f in files:

            # Don't include local configuration in the install.
            if f in ('package.py', 'time_zone.py', 'DatabaseConfig.py',
                     'RaceDB.json', 'AllowedHosts.py', 'FixJsonImport.py'):
                print('****************************************')
                print('skipping: {}'.format(f))
                print('****************************************')
                continue

            fname = os.path.join(root, f)
            if 'racedb' in fname.lower() and fname.lower().endswith('.json'):
                continue
            if any(d in fname for d in [
                    'env', 'EV', 'GFRR', 'usac_heatmap', 'usac_bug',
                    'test_data', 'migrations_old', "bugs", '.vscode',
                    'release', 'docker'
            ]):
                continue
            if os.path.splitext(fname)[1][1:] in suffixes:
                print('writing: {}'.format(fname[2:]))
                zf.write(fname, os.path.join(installDir, fname))
                # Strip off the ./
                tf.add(fname,
                       os.path.join(installDir, fname[2:]),
                       recursive=False,
                       filter=reset)

    zf.close()
    tf.close()
    print("Created: {}".format(zfname))
    print("Created: {}".format(tfname))