<commit_before>;; This is a wrapper around `winvers-change.ss' to patch binary files with the
;; current version number.

#lang scheme/base

(require mzlib/file "main-collects.ss" "dirs.ss")

(define (make-copy)
  (let* ([tmpdir (find-system-path 'temp-dir)]
         [vers (build-path tmpdir "setvers")])
    (unless (directory-exists? vers) (make-directory vers))
    (for ([p (in-list '("racket.exe" "lib"))])
      (let ([dest (build-path vers p)])
        ((cond [(file-exists? dest) delete-file]
               [(directory-exists? dest) delete-directory/files]
               [else void])
         dest)
        (copy-directory/files (build-path (find-console-bin-dir) p) dest)))
    (build-path vers "racket.exe")))

(define (patch-files)
  (parameterize ([current-command-line-arguments
                  (vector (path->string (find-console-bin-dir)))])
    (dynamic-require 'setup/winvers-change #f)))

(define collects-dir
  (path->string (find-collects-dir)))

(let ([argv (current-command-line-arguments)])
  (cond [(equal? argv #())
         (let ([exe (make-copy)])
           (printf "re-launching first time...\n")
           (subprocess
            (current-output-port) (current-input-port) (current-error-port)
            exe "--collects" collects-dir
            "-l" "setup/winvers" "patch"))]
        [(equal? argv #("patch"))
         (sleep 1) ; time for other process to end
         (patch-files)
         (printf "re-launching last time...\n")
         (subprocess
          (current-output-port) (current-input-port) (current-error-port)
          (build-path (find-console-bin-dir) "racket.exe")
          "-l" "setup/winvers" "finish")]
        [(equal? argv #("finish"))
         (sleep 1) ; time for other process to end
         (delete-directory/files
          (build-path (find-system-path 'temp-dir) "setvers"))
         (printf "done!\n")]
        [else (error 'winvers "unknown command line: ~e" argv)]))<commit_msg>Avoid useless output<commit_after>;; This is a wrapper around `winvers-change.ss' to patch binary files with the
;; current version number.

#lang scheme/base

(require mzlib/file "main-collects.ss" "dirs.ss")

(define (make-copy)
  (let* ([tmpdir (find-system-path 'temp-dir)]
         [vers (build-path tmpdir "setvers")])
    (unless (directory-exists? vers) (make-directory vers))
    (for ([p (in-list '("racket.exe" "lib"))])
      (let ([dest (build-path vers p)])
        ((cond [(file-exists? dest) delete-file]
               [(directory-exists? dest) delete-directory/files]
               [else void])
         dest)
        (copy-directory/files (build-path (find-console-bin-dir) p) dest)))
    (build-path vers "racket.exe")))

(define (patch-files)
  (parameterize ([current-command-line-arguments
                  (vector (path->string (find-console-bin-dir)))])
    (dynamic-require 'setup/winvers-change #f)))

(define collects-dir
  (path->string (find-collects-dir)))

(let ([argv (current-command-line-arguments)])
  (cond [(equal? argv #())
         (let ([exe (make-copy)])
           (printf "re-launching first time...\n")
           (subprocess
            (current-output-port) (current-input-port) (current-error-port)
            exe "--collects" collects-dir
            "-l" "setup/winvers" "patch"))]
        [(equal? argv #("patch"))
         (sleep 1) ; time for other process to end
         (patch-files)
         (printf "re-launching last time...\n")
         (subprocess
          (current-output-port) (current-input-port) (current-error-port)
          (build-path (find-console-bin-dir) "racket.exe")
          "-l" "setup/winvers" "finish")]
        [(equal? argv #("finish"))
         (sleep 1) ; time for other process to end
         (delete-directory/files
          (build-path (find-system-path 'temp-dir) "setvers"))
         (printf "done!\n")]
        [else (error 'winvers "unknown command line: ~e" argv)])
  (void))
{'fraction_non_alphanumeric': 0.17006109979633402, 'fraction_numerical': 0.0010183299389002036, 'mean_word_length': 2.483156028368794, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6508509', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1224, 'n_words': 310}